mirror of
https://github.com/immich-app/immich.git
synced 2025-07-03 21:40:00 +02:00
fix(web): sharing of access token in server API (#1858)
This commit is contained in:
parent
3ea107be5a
commit
cc6253ba38
14 changed files with 43 additions and 58 deletions
web/src
|
@ -1,7 +1,14 @@
|
|||
import type { Handle, HandleServerError } from '@sveltejs/kit';
|
||||
import { AxiosError } from 'axios';
|
||||
import { env } from '$env/dynamic/public';
|
||||
import { ImmichApi } from './api/api';
|
||||
|
||||
export const handle = (async ({ event, resolve }) => {
|
||||
event.locals.api = new ImmichApi({
|
||||
basePath: env.PUBLIC_IMMICH_SERVER_URL || 'http://immich-server:3001',
|
||||
accessToken: event.cookies.get('immich_access_token')
|
||||
});
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
const res = await resolve(event);
|
||||
|
||||
// The link header can grow quite big and has caused issues with our nginx
|
||||
|
@ -9,7 +16,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||
res.headers.delete('Link');
|
||||
|
||||
return res;
|
||||
};
|
||||
}) satisfies Handle;
|
||||
|
||||
export const handleError: HandleServerError = async ({ error }) => {
|
||||
const httpError = error as AxiosError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue