mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Migrate SvelteKit to the latest version 431 (#526)
This commit is contained in:
21
web/src/routes/+page.ts
Normal file
21
web/src/routes/+page.ts
Normal 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
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user