feat(main): initial commit
This commit is contained in:
24
frontend/src/api.js
Normal file
24
frontend/src/api.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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...
|
||||
Reference in New Issue
Block a user