feat: make redirects replace current url so you can go back to previous page without being immediately redirected
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
This commit is contained in:
parent
038b1af44e
commit
80f05bb514
1 changed files with 3 additions and 2 deletions
|
@ -43,6 +43,7 @@ const registrationEnabled = ref<boolean>(true);
|
||||||
const apiBase = useCookie("api_base");
|
const apiBase = useCookie("api_base");
|
||||||
|
|
||||||
if (apiBase.value) {
|
if (apiBase.value) {
|
||||||
|
console.log("apiBase:", apiBase.value);
|
||||||
const statsUrl = new URL("/stats", apiBase.value).href;
|
const statsUrl = new URL("/stats", apiBase.value).href;
|
||||||
const { status, data } = await useFetch<StatsResponse>(statsUrl);
|
const { status, data } = await useFetch<StatsResponse>(statsUrl);
|
||||||
if (status.value == "success" && data.value) {
|
if (status.value == "success" && data.value) {
|
||||||
|
@ -62,9 +63,9 @@ async function formLogin(e: Event) {
|
||||||
console.log("logged in");
|
console.log("logged in");
|
||||||
if (query.redirect_to) {
|
if (query.redirect_to) {
|
||||||
console.log("redirecting to:", query.redirect_to);
|
console.log("redirecting to:", query.redirect_to);
|
||||||
return await navigateTo(query.redirect_to);
|
return await navigateTo(query.redirect_to, { replace: true });
|
||||||
}
|
}
|
||||||
return await navigateTo("/");
|
return await navigateTo("/", { replace: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error logging in:", error);
|
console.error("Error logging in:", error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue