Skip to content

High performance self-hosted photo and video management solution.

feat(web): reactively update shared link expiration (#22274)

Basharat Ahmad Khan0a6b2ad26edb
diff --git a/web/src/lib/modals/SharedLinkCreateModal.svelte b/web/src/lib/modals/SharedLinkCreateModal.svelte
index 88f603c16b..3971b91fac 100644
--- a/web/src/lib/modals/SharedLinkCreateModal.svelte
+++ b/web/src/lib/modals/SharedLinkCreateModal.svelte
@@ -103,7 +103,7 @@
try {
const expirationDate = expirationOption > 0 ? DateTime.now().plus(expirationOption).toISO() : null;
- await updateSharedLink({
+ const updatedLink = await updateSharedLink({
id: editingLink.id,
sharedLinkEditDto: {
description,
@@ -121,7 +121,7 @@
message: $t('edited'),
});
- onClose();
+ onClose(updatedLink);
} catch (error) {
handleError(error, $t('errors.failed_to_edit_shared_link'));
}
diff --git a/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte b/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte
index ea1c47f0f8..e37301300e 100644
--- a/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte
+++ b/web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte
@@ -54,8 +54,15 @@
}
};
- const handleEditDone = async () => {
- await refresh();
+ const handleEditDone = async (updatedLink?: SharedLinkResponseDto) => {
+ if (updatedLink) {
+ const index = sharedLinks.findIndex((link) => link.id === updatedLink.id);
+ if (index !== -1) {
+ sharedLinks[index] = updatedLink;
+ }
+ } else {
+ await refresh();
+ }
await goto(AppRoute.SHARED_LINKS);
};