Files
PYTV/frontend/src/api.js

25 lines
727 B
JavaScript
Raw Normal View History

2026-03-08 11:28:59 -04:00
import axios from 'axios';
// The base URL relies on the Vite proxy in development,
// and same-origin in production.
const apiClient = axios.create({
baseURL: '/api',
headers: {
'Content-Type': 'application/json',
},
});
export const fetchChannels = async () => {
const response = await apiClient.get('/channel/');
return response.data;
};
// If a channel is selected, we can load its upcoming airings
export const fetchScheduleGenerations = async (channelId) => {
// We can trigger an immediate generation for the day to ensure there's data
const response = await apiClient.post(`/schedule/generate/${channelId}`);
return response.data;
};
// Future logic can query specific lists of Airings here...