Migrate SvelteKit to the latest version 431 (#526)

This commit is contained in:
Alex
2022-08-24 21:10:48 -07:00
committed by GitHub
parent fb0fa742f5
commit db2ed2d881
47 changed files with 1509 additions and 1216 deletions

21
web/src/routes/+page.ts Normal file
View File

@@ -0,0 +1,21 @@
export const prerender = false;
import { redirect } from '@sveltejs/kit';
import { api } from '@api';
import { browser } from '$app/env';
import type { PageLoad } from './$types';
import { goto } from '$app/navigation';
export const load: PageLoad = async ({ parent }) => {
const { user } = await parent();
if (user) {
throw redirect(302, '/photos');
}
if (browser) {
const { data } = await api.userApi.getUserCount();
return {
isAdminUserExist: data.userCount != 0
};
}
};