Add libauth.ts for centralised authentication

This commit is contained in:
Fred Boniface
2023-08-24 13:32:12 +01:00
parent 73dd219394
commit 55831164ed
2 changed files with 67 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
import Loading from '$lib/navigation/loading.svelte';
import { onMount } from 'svelte';
import { uuid } from '$lib/stores/uuid.js';
import { checkAuth } from '$lib/libauth';
const title = 'Register';
@@ -38,17 +39,14 @@
isLoading = false;
}
$: {
if ($uuid != 'null') {
state = 'reg'
} else state = 'unreg'
}
/* onMount(async () => {
if ($uuid != 'null') {
onMount(async () => {
const auth = await checkAuth();
if (auth.uuidPresent === false) {
state = 'unreg';
} else if (auth.uuidPresent === true) {
state = 'reg';
}
});*/
});
</script>
{#if isLoading}