fix(web): show download button correctly based on shared link permission (#8288)
* fix(web): show download button correctly based on shared link permission * remove console log * Define initial value * simpler implementation * refactor: show download in asset viewer for shared link * chore: hook timeout --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import { getMySharedLink, SharedLinkType } from '@immich/sdk';
|
||||
import type { PageData } from './$types';
|
||||
import { setSharedLink } from '$lib/utils';
|
||||
|
||||
export let data: PageData;
|
||||
let { sharedLink, passwordRequired, sharedLinkKey: key, meta } = data;
|
||||
@@ -19,6 +20,7 @@
|
||||
const handlePasswordSubmit = async () => {
|
||||
try {
|
||||
sharedLink = await getMySharedLink({ password, key });
|
||||
setSharedLink(sharedLink);
|
||||
passwordRequired = false;
|
||||
isOwned = $user ? $user.id === sharedLink.userId : false;
|
||||
title = (sharedLink.album ? sharedLink.album.albumName : 'Public Share') + ' - Immich';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getAssetThumbnailUrl } from '$lib/utils';
|
||||
import { getAssetThumbnailUrl, setSharedLink } from '$lib/utils';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { ThumbnailFormat, getMySharedLink, isHttpError } from '@immich/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -9,6 +9,7 @@ export const load = (async ({ params }) => {
|
||||
|
||||
try {
|
||||
const sharedLink = await getMySharedLink({ key });
|
||||
setSharedLink(sharedLink);
|
||||
const assetCount = sharedLink.assets.length;
|
||||
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user