mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-08 20:29:05 +00:00
Fix error in logout procedure and guard for each route (#439)
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
<script context="module" lang="ts">
|
||||
export const prerender = false;
|
||||
|
||||
import { browser } from '$app/env';
|
||||
import type { Load } from '@sveltejs/kit';
|
||||
|
||||
export const load: Load = async ({ fetch }) => {
|
||||
try {
|
||||
await fetch('/data/user/get-my-user-info');
|
||||
|
||||
return {
|
||||
status: 302,
|
||||
redirect: '/photos'
|
||||
};
|
||||
} catch (e) {
|
||||
export const load: Load = async ({ session }) => {
|
||||
if (!browser && !session.user) {
|
||||
return {
|
||||
status: 302,
|
||||
redirect: '/auth/login'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
status: 302,
|
||||
redirect: '/photos'
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
import type { Load } from '@sveltejs/kit';
|
||||
import { setAssetInfo } from '$lib/stores/assets';
|
||||
export const load: Load = async ({ fetch, session }) => {
|
||||
if (!browser && !session.user) {
|
||||
return {
|
||||
status: 302,
|
||||
redirect: '/auth/login'
|
||||
};
|
||||
}
|
||||
|
||||
export const load: Load = async ({ fetch }) => {
|
||||
try {
|
||||
const [userInfo, assets] = await Promise.all([
|
||||
fetch('/data/user/get-my-user-info').then((r) => r.json()),
|
||||
@@ -40,6 +46,7 @@
|
||||
import { openFileUploadDialog, UploadType } from '$lib/utils/file-uploader';
|
||||
import { AssetResponseDto, UserResponseDto } from '@api';
|
||||
import SideBar from '$lib/components/shared-components/side-bar/side-bar.svelte';
|
||||
import { browser } from '$app/env';
|
||||
|
||||
export let user: UserResponseDto;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user