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