Use ?params

This commit is contained in:
Adria Navarro 2023-12-18 10:59:33 +01:00
parent 13f80ad735
commit c80504ca93
2 changed files with 4 additions and 5 deletions

View File

@ -53,7 +53,7 @@ export const API = createAPIClient({
} }
get(navigation).goto( get(navigation).goto(
`${updatingUrl}?returnUrl=${encodeURIComponent(window.location)}` `${updatingUrl}?returnUrl=${encodeURIComponent(window.location.pathname)}`
) )
}, },
}) })

View File

@ -1,6 +1,6 @@
<script> <script>
import Spinner from "components/common/Spinner.svelte" import Spinner from "components/common/Spinner.svelte"
import { redirect } from "@roxi/routify" import { redirect, params } from "@roxi/routify"
import { API } from "api" import { API } from "api"
@ -18,9 +18,8 @@
return migrationTimeout() return migrationTimeout()
} }
const urlParams = new URLSearchParams(window.location.search) // For some reason routify params is not stripping the ? properly, so we need to check both with and without ?
const returnUrl = urlParams.get("returnUrl") const returnUrl = $params.returnUrl || $params["?returnUrl"]
$redirect(returnUrl) $redirect(returnUrl)
}, 1000) }, 1000)
} }