Update Navbar component and add logout functionality
This commit is contained in:
1
.env.example
Normal file
1
.env.example
Normal file
@@ -0,0 +1 @@
|
|||||||
|
DATABASE_URL=
|
||||||
@@ -62,8 +62,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if user}
|
{#if user}
|
||||||
<UserAvatar {user} />
|
<UserAvatar {user} />
|
||||||
<form method="post" use:enhance>
|
<form method="post" action="/" use:enhance>
|
||||||
<button class="btn btn-primary ml-4">Sign out</button>
|
<button class="btn btn-primary ml-4">Logout</button>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const load: PageServerLoad = async (event) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// handle the logout action
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
default: async (event) => {
|
default: async (event) => {
|
||||||
if (!event.locals.session) {
|
if (!event.locals.session) {
|
||||||
|
|||||||
Reference in New Issue
Block a user