fix(cospend): redirect to dash after adding payment

Server action redirected to /cospend which routes to /list. Now
redirects to the dashboard in the current locale's root.
This commit is contained in:
2026-04-21 16:36:26 +02:00
parent 2f2fcc2f51
commit b66c458a4d
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "homepage", "name": "homepage",
"version": "1.42.0", "version": "1.42.1",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -17,7 +17,7 @@ export const load: PageServerLoad = async ({ locals }) => {
}; };
export const actions: Actions = { export const actions: Actions = {
default: async ({ request, locals, fetch }) => { default: async ({ request, locals, fetch, params }) => {
const session = await locals.auth(); const session = await locals.auth();
if (!session || !session.user?.nickname) { if (!session || !session.user?.nickname) {
@@ -217,7 +217,7 @@ export const actions: Actions = {
} }
// Success - redirect to dashboard // Success - redirect to dashboard
throw redirect(303, '/cospend'); throw redirect(303, `/${params.cospendRoot}/dash`);
} catch (error: unknown) { } catch (error: unknown) {
if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 303) throw error; // Re-throw redirect if (error && typeof error === 'object' && 'status' in error && (error as { status: number }).status === 303) throw error; // Re-throw redirect