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:
+1
-1
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user