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

View File

@@ -0,0 +1,23 @@
import { browser } from '$app/env';
import { api, serverApi } from '@api';
import * as cookieParser from 'cookie';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = async ({ request }) => {
const cookies = cookieParser.parse(request.headers.get('cookie') || '');
const accessToken = cookies['immich_access_token'];
if (!accessToken) {
return {
user: undefined
};
}
serverApi.setAccessToken(accessToken);
const { data: userInfo } = await serverApi.userApi.getMyUserInfo();
return {
user: userInfo
};
};