mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: use <a> tag for albums in list view (#5645)
* fix: multiple improvements * pr feedback * optimize
This commit is contained in:
parent
fb4b4e5895
commit
fba9e784fb
16 changed files with 86 additions and 59 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue