Skip to content

Commit

Permalink
Request to fix (#117), user cannot sign out during create_profile sec…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
ericpb committed Aug 13, 2024
1 parent f0d0516 commit cabfc63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/routes/(admin)/account/create_profile/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@
<div class="text-sm text-slate-800 mt-14">
You are logged in as {session?.user?.email}.
<br />
<a class="underline" href="/account/sign_out"> Sign out </a>
<form action="/account/sign_out" method="POST">
<button type="submit" class="underline">Sign out</button>
</form>
</div>
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/routes/(admin)/account/sign_out/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { redirect } from "@sveltejs/kit"

export const actions = {
default: async ({ locals: { supabase, safeGetSession } }) => {
const { session } = await safeGetSession()
if (session) {
await supabase.auth.signOut()
}
redirect(303, "/")
},
}

0 comments on commit cabfc63

Please sign in to comment.