diff --git a/frontend/src/routes/admin/tags/[id]/+page.server.ts b/frontend/src/routes/admin/tags/[id]/+page.server.ts index da3e5e26..ffa99d47 100644 --- a/frontend/src/routes/admin/tags/[id]/+page.server.ts +++ b/frontend/src/routes/admin/tags/[id]/+page.server.ts @@ -3,11 +3,11 @@ import type { PageServerLoad, Actions } from './$types'; import { createApiClient } from '$lib/api.server'; import { getErrorMessage } from '$lib/errors'; -export const load: PageServerLoad = async ({ params, parent }) => { +export const load: PageServerLoad = async ({ params, parent, url }) => { const { tags } = await parent(); const tag = tags.find((t: { id: string }) => t.id === params.id); if (!tag) throw error(404, getErrorMessage('TAG_NOT_FOUND')); - return { tag }; + return { tag, mergeSuccess: url.searchParams.has('merged') }; }; export const actions: Actions = { @@ -47,7 +47,7 @@ export const actions: Actions = { return fail(result.response.status, { error: getErrorMessage(code) }); } - return { mergeSuccess: true, mergeTargetId: result.data!.id }; + throw redirect(303, `/admin/tags/${result.data!.id}?merged=1`); }, delete: async ({ params, request, fetch }) => { diff --git a/frontend/src/routes/admin/tags/[id]/+page.svelte b/frontend/src/routes/admin/tags/[id]/+page.svelte index daae6402..51a0ce27 100644 --- a/frontend/src/routes/admin/tags/[id]/+page.svelte +++ b/frontend/src/routes/admin/tags/[id]/+page.svelte @@ -1,5 +1,7 @@