mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-20 15:55:42 +02:00
34 lines
748 B
TypeScript
34 lines
748 B
TypeScript
import {env} from '$env/dynamic/public';
|
|
import type {LayoutLoad} from './$types';
|
|
|
|
export const load: LayoutLoad = async ({fetch}) => {
|
|
try {
|
|
const requests = await fetch(`${env.PUBLIC_API_URL}/tv/seasons/requests`, {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
credentials: 'include'
|
|
});
|
|
|
|
if (!requests.ok) {
|
|
console.error(`Failed to fetch season requests ${requests.statusText}`);
|
|
return {
|
|
requestsData: null
|
|
};
|
|
}
|
|
|
|
const requestsData = await requests.json();
|
|
console.log('Fetched season requests:', requestsData);
|
|
|
|
return {
|
|
requestsData: requestsData
|
|
};
|
|
} catch (error) {
|
|
console.error('Error fetching season requests:', error);
|
|
return {
|
|
requestsData: null
|
|
};
|
|
}
|
|
};
|