When signing out, check if user is anonymous
This commit is contained in:
parent
11856a0f04
commit
9628d5e48e
1 changed files with 9 additions and 4 deletions
|
@ -3,8 +3,13 @@ import { supabase } from "@library/supabase"
|
||||||
import type { Provider } from "@supabase/supabase-js"
|
import type { Provider } from "@supabase/supabase-js"
|
||||||
|
|
||||||
export const GET: APIRoute = async ({ cookies, redirect }) => {
|
export const GET: APIRoute = async ({ cookies, redirect }) => {
|
||||||
cookies.delete("sb-access-token", { path: "/" })
|
|
||||||
cookies.delete("sb-refresh-token", { path: "/" })
|
if(cookies.get('anonymous-session')) {
|
||||||
const { error } = await supabase.auth.signOut()
|
return redirect('/account/anon/end')
|
||||||
return redirect("/signin")
|
} else {
|
||||||
|
cookies.delete("sb-access-token", { path: "/" })
|
||||||
|
cookies.delete("sb-refresh-token", { path: "/" })
|
||||||
|
const { error } = await supabase.auth.signOut()
|
||||||
|
}
|
||||||
|
return redirect("/")
|
||||||
}
|
}
|
Loading…
Reference in a new issue