File tree Expand file tree Collapse file tree 5 files changed +29
-8
lines changed Expand file tree Collapse file tree 5 files changed +29
-8
lines changed Original file line number Diff line number Diff line change 1+ <!--
12<script lang="ts">
23 import { page } from '$app/stores'
34</script>
5+ -->
46
57<svelte:head >
68 <title > SvelteKit Authentication</title >
79</svelte:head >
810
9- <nav >
11+ <!-- < nav>
1012 {#if $page.data.user}
11- <!-- < a href="/admin">Admin </a> -- >
13+ <a href="/main">Main </a>
1214
1315 <form action="/logout" method="POST">
1416 <button type="submit">Log out</button>
1719 <a href="/login">Log in</a>
1820 <a href="/register">Register</a>
1921 {/if}
20- </nav >
22+ </nav> -->
2123
2224<main >
2325 <slot />
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import { page } from ' $app/stores'
3+ </script >
4+
5+ <svelte:head >
6+ <title >SvelteKit Authentication</title >
7+ </svelte:head >
8+
19<h1 >Welcome to SvelteKit Authentication</h1 >
2- <p >Visit <a href =" https://github.com/sinProject-Inc/sveltekit_authentication" >GitHub Repository</a > to read the documentation</p >
10+ <p >
11+ Visit <a href =" https://github.com/sinProject-Inc/sveltekit_authentication" >GitHub Repository</a > to
12+ read the documentation
13+ </p >
14+
15+ {#if $page .data .user }
16+ <a href =" /main" >Main</a >
317
18+ <form action =" /logout" method =" POST" >
19+ <button type =" submit" >Log out</button >
20+ </form >
21+ {:else }
22+ <a href =" /login" >Log in</a >
23+ <a href =" /register" >Register</a >
24+ {/if }
Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ export const actions: Actions = {
1212 expires : new Date ( 0 ) ,
1313 } )
1414
15- throw redirect ( 302 , '/login ' )
15+ throw redirect ( 302 , '/' )
1616 }
1717}
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ import { redirect } from "@sveltejs/kit";
22import type { PageServerLoad } from "./$types" ;
33
44export const load : PageServerLoad = async ( { locals } ) => {
5- if ( ! locals . user ) throw redirect ( 302 , '/login ' )
5+ if ( ! locals . user ) throw redirect ( 302 , '/' )
66}
Original file line number Diff line number Diff line change @@ -35,8 +35,6 @@ export const actions: Actions = {
3535 return invalid ( 400 , { user_exists : true } )
3636 }
3737
38- console . log ( 'aaa' )
39-
4038 throw redirect ( 303 , '/login' )
4139 } ,
4240}
You can’t perform that action at this time.
0 commit comments