Force redirection to home page of requesting /auth when logged
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5e20cec59d
commit
5096d0fb0b
@ -1,20 +1,9 @@
|
|||||||
<script context="module">
|
|
||||||
import { session } from '$app/stores';
|
|
||||||
|
|
||||||
export function load() {
|
|
||||||
if (session.id) {
|
|
||||||
return { redirect: '/', status: 302 };
|
|
||||||
}
|
|
||||||
|
|
||||||
return { };
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
|
|
||||||
import AuthButton from '../components/AuthButton.svelte';
|
import AuthButton from '../components/AuthButton.svelte';
|
||||||
|
import { user } from '../stores/user';
|
||||||
|
|
||||||
let auth = { username: "", password: "" };
|
let auth = { username: "", password: "" };
|
||||||
let pleaseWait = false;
|
let pleaseWait = false;
|
||||||
@ -30,7 +19,6 @@
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
response.json().then((auth) => {
|
response.json().then((auth) => {
|
||||||
pleaseWait = false;
|
pleaseWait = false;
|
||||||
$session = auth;
|
|
||||||
if (next && next.indexOf('//') === -1) {
|
if (next && next.indexOf('//') === -1) {
|
||||||
goto(next)
|
goto(next)
|
||||||
} else {
|
} else {
|
||||||
@ -48,6 +36,16 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if ($user && $user.id) {
|
||||||
|
if (next && next.indexOf('//') === -1) {
|
||||||
|
goto(next)
|
||||||
|
} else {
|
||||||
|
goto(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Reference in New Issue
Block a user