diff --git a/src/routes/(app)/+page.ts b/src/routes/(app)/+page.ts index c8ac7ff83..fac4b8f49 100644 --- a/src/routes/(app)/+page.ts +++ b/src/routes/(app)/+page.ts @@ -1,12 +1,16 @@ import { redirect } from "@sveltejs/kit"; -import { searchUrl, userDocs } from "$lib/utils/search"; +import { userDocs } from "$lib/utils/search"; -export async function load({ parent }) { +export async function load({ parent, url }) { const { me } = await parent(); + const u = new URL(url); if (me) { - return redirect(302, searchUrl(userDocs(me))); + u.pathname = "/documents/"; + u.searchParams.set("q", userDocs(me)); + return redirect(302, u); } - return redirect(302, "/home/"); + u.pathname = "/home/"; + return redirect(302, u); } diff --git a/src/routes/(app)/app/+page.ts b/src/routes/(app)/app/+page.ts index 8cfe5474c..d09b95a62 100644 --- a/src/routes/(app)/app/+page.ts +++ b/src/routes/(app)/app/+page.ts @@ -2,6 +2,11 @@ import { redirect } from "@sveltejs/kit"; -export function load() { - return redirect(302, "/"); +export function load({ url }) { + const u = new URL(url); + + // change the path but preserve other parts of the URL + u.pathname = "/documents/"; + + return redirect(302, u); }