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"
|
||||
|
||||
export const GET: APIRoute = async ({ cookies, redirect }) => {
|
||||
|
||||
if(cookies.get('anonymous-session')) {
|
||||
return redirect('/account/anon/end')
|
||||
} else {
|
||||
cookies.delete("sb-access-token", { path: "/" })
|
||||
cookies.delete("sb-refresh-token", { path: "/" })
|
||||
const { error } = await supabase.auth.signOut()
|
||||
return redirect("/signin")
|
||||
}
|
||||
return redirect("/")
|
||||
}
|
Loading…
Reference in a new issue