Fix popular page being disabled
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
import { getPopular } from '$lib/Api/index.js';
|
||||
import { getPopular, getTrending } from '$lib/Api/index.js';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export async function load({ params }) {
|
||||
export async function load() {
|
||||
let popular;
|
||||
|
||||
try {
|
||||
popular = await getPopular();
|
||||
} catch (errorMessage: any) {
|
||||
if (errorMessage.toString() === 'Error: Administrator has disabled this endpoint.') {
|
||||
popular = await getTrending();
|
||||
} else {
|
||||
error(500, errorMessage);
|
||||
}
|
||||
}
|
||||
return {
|
||||
popular: await getPopular()
|
||||
popular: popular
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user