2022-08-25 06:10:48 +02:00
|
|
|
export const prerender = false;
|
2023-02-24 21:42:20 +01:00
|
|
|
|
2023-07-01 06:50:47 +02:00
|
|
|
import { AppRoute } from '$lib/constants';
|
2022-08-25 06:10:48 +02:00
|
|
|
import { redirect } from '@sveltejs/kit';
|
2023-02-15 20:09:28 +01:00
|
|
|
import type { PageServerLoad } from './$types';
|
2022-08-25 06:10:48 +02:00
|
|
|
|
2023-02-24 21:42:20 +01:00
|
|
|
export const load = (async ({ parent, locals: { api } }) => {
|
2023-07-01 06:50:47 +02:00
|
|
|
const { user } = await parent();
|
|
|
|
if (user) {
|
|
|
|
throw redirect(302, AppRoute.PHOTOS);
|
|
|
|
}
|
2023-01-11 04:36:50 +01:00
|
|
|
|
2023-10-11 04:37:13 +02:00
|
|
|
const { data } = await api.serverInfoApi.getServerConfig();
|
2023-02-15 20:09:28 +01:00
|
|
|
|
2023-10-11 04:37:13 +02:00
|
|
|
if (data.isInitialized) {
|
|
|
|
// Redirect to login page if there exists an admin account (i.e. server is initialized)
|
2023-07-01 06:50:47 +02:00
|
|
|
throw redirect(302, AppRoute.AUTH_LOGIN);
|
|
|
|
}
|
2023-02-15 13:42:41 +01:00
|
|
|
|
2023-07-01 06:50:47 +02:00
|
|
|
return {
|
|
|
|
meta: {
|
|
|
|
title: 'Welcome 🎉',
|
|
|
|
description: 'Immich Web Interface',
|
|
|
|
},
|
|
|
|
};
|
2023-02-24 21:42:20 +01:00
|
|
|
}) satisfies PageServerLoad;
|