Improved authentication by checking the jwt in SvelteKit

This commit is contained in:
Mawoka
2023-01-29 12:26:19 +01:00
parent 9d39a77f35
commit ac28c0f793
6 changed files with 288 additions and 233 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { signedIn } from '$lib/stores';
import type { LayoutLoad } from './$types';
import type { LayoutServerLoad } from './$types';
export const load: LayoutLoad = async ({ locals }) => {
export const load: LayoutServerLoad = async ({ locals }) => {
if (locals.email) {
signedIn.set(true);
} else {
@@ -2,7 +2,6 @@ import { redirect } from '@sveltejs/kit';
export const load = async ({ parent }) => {
const { email } = await parent();
if (!email) {
throw redirect(302, '/account/login?returnTo=/dashboard');
}
+1 -1
View File
@@ -73,7 +73,7 @@
};
$: {
search_term;
console.log(search_term);
// console.log(search_term);
search();
}
</script>