Forward query params while redirecting to /home or /file
This commit is contained in:
@ -71,11 +71,14 @@ const router = createRouter([
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: PATHS.INDEX,
|
path: PATHS.INDEX,
|
||||||
loader: async () => {
|
loader: async ({ request }) => {
|
||||||
const onDesktop = isDesktop()
|
const onDesktop = isDesktop()
|
||||||
|
const url = new URL(request.url)
|
||||||
return onDesktop
|
return onDesktop
|
||||||
? redirect(PATHS.HOME)
|
? redirect(PATHS.HOME + (url.search || ''))
|
||||||
: redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
: redirect(
|
||||||
|
PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME + (url.search || '')
|
||||||
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -174,11 +174,14 @@ export const fileLoader: LoaderFunction = async (
|
|||||||
|
|
||||||
// Loads the settings and by extension the projects in the default directory
|
// Loads the settings and by extension the projects in the default directory
|
||||||
// and returns them to the Home route, along with any errors that occurred
|
// and returns them to the Home route, along with any errors that occurred
|
||||||
export const homeLoader: LoaderFunction = async (): Promise<
|
export const homeLoader: LoaderFunction = async ({
|
||||||
HomeLoaderData | Response
|
request,
|
||||||
> => {
|
}): Promise<HomeLoaderData | Response> => {
|
||||||
|
const url = new URL(request.url)
|
||||||
if (!isDesktop()) {
|
if (!isDesktop()) {
|
||||||
return redirect(PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME)
|
return redirect(
|
||||||
|
PATHS.FILE + '/%2F' + BROWSER_PROJECT_NAME + (url.search || '')
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user