Fix error in logout procedure and guard for each route (#439)

This commit is contained in:
Alex
2022-08-07 18:36:34 -05:00
committed by GitHub
parent f881981c44
commit 28c7736ecd
9 changed files with 58 additions and 20 deletions
@@ -1,11 +1,10 @@
<script context="module" lang="ts">
export const prerender = false;
import { browser } from '$app/env';
import type { Load } from '@sveltejs/kit';
export const load: Load = async ({ params }) => {
try {
await fetch('/data/user/get-my-user-info');
} catch (e) {
export const load: Load = async ({ params, session }) => {
if (!browser && !session.user) {
return {
status: 302,
redirect: '/auth/login'