1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-30 05:29:30 +02:00

feat: use <a> tag for albums in list view (#5645)

* fix: multiple improvements

* pr feedback

* optimize
This commit is contained in:
martin
2023-12-12 03:35:57 +01:00
committed by GitHub
parent fb4b4e5895
commit fba9e784fb
16 changed files with 86 additions and 59 deletions

View File

@ -1,6 +1,7 @@
import { api } from '@api';
import { redirect } from '@sveltejs/kit';
import { AppRoute } from '../constants';
import { getSavedUser, setUser } from '$lib/stores/user.store';
export interface AuthOptions {
admin?: true;
@ -19,7 +20,9 @@ export const getAuthUser = async () => {
export const authenticate = async (options?: AuthOptions) => {
options = options || {};
const user = await getAuthUser();
const savedUser = getSavedUser();
const user = savedUser || (await getAuthUser());
if (!user) {
throw redirect(302, AppRoute.AUTH_LOGIN);
}
@ -28,6 +31,10 @@ export const authenticate = async (options?: AuthOptions) => {
throw redirect(302, AppRoute.PHOTOS);
}
if (!savedUser) {
setUser(user);
}
return user;
};