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(
`${updatingUrl}?returnUrl=${encodeURIComponent(window.location)}`
`${updatingUrl}?returnUrl=${encodeURIComponent(window.location.pathname)}`
)
},
})

View File

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