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>
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores'
|
||||
|
||||
import AuthButton from '../components/AuthButton.svelte';
|
||||
import { user } from '../stores/user';
|
||||
|
||||
let auth = { username: "", password: "" };
|
||||
let pleaseWait = false;
|
||||
@ -30,7 +19,6 @@
|
||||
.then((response) => {
|
||||
response.json().then((auth) => {
|
||||
pleaseWait = false;
|
||||
$session = auth;
|
||||
if (next && next.indexOf('//') === -1) {
|
||||
goto(next)
|
||||
} else {
|
||||
@ -48,6 +36,16 @@
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$: {
|
||||
if ($user && $user.id) {
|
||||
if (next && next.indexOf('//') === -1) {
|
||||
goto(next)
|
||||
} else {
|
||||
goto(".");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="row">
|
||||
|
Reference in New Issue
Block a user