mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
fix(web): auth on navigation from shared link to timeline (#12385)
This commit is contained in:
parent
aa0097bde2
commit
9fc30d6bf6
3 changed files with 14 additions and 1 deletions
|
@ -69,4 +69,15 @@ test.describe('Shared Links', () => {
|
|||
await page.goto('/share/invalid');
|
||||
await page.getByRole('heading', { name: 'Invalid share key' }).waitFor();
|
||||
});
|
||||
|
||||
test('auth on navigation from shared link to timeline', async ({ context, page }) => {
|
||||
await utils.setAuthCookies(context, admin.accessToken);
|
||||
|
||||
await page.goto(`/share/${sharedLink.key}`);
|
||||
await page.getByRole('heading', { name: 'Test Album' }).waitFor();
|
||||
|
||||
await page.locator('a[href="/"]').click();
|
||||
await page.waitForURL('/photos');
|
||||
await page.locator(`[data-asset-id="${asset.id}"]`).waitFor();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -156,7 +156,7 @@ export const getJobName = derived(t, ($t) => {
|
|||
let _key: string | undefined;
|
||||
let _sharedLink: SharedLinkResponseDto | undefined;
|
||||
|
||||
export const setKey = (key: string) => (_key = key);
|
||||
export const setKey = (key?: string) => (_key = key);
|
||||
export const getKey = (): string | undefined => _key;
|
||||
export const setSharedLink = (sharedLink: SharedLinkResponseDto) => (_sharedLink = sharedLink);
|
||||
export const getSharedLink = (): SharedLinkResponseDto | undefined => _sharedLink;
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
}
|
||||
|
||||
beforeNavigate(({ from, to }) => {
|
||||
setKey(isSharedLinkRoute(to?.route.id) ? to?.params?.key : undefined);
|
||||
|
||||
if (isAssetViewerRoute(from) && isAssetViewerRoute(to)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue