File size: 419 Bytes
17fabdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"use server";
import { createClient } from "@/utils/supabase/server";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";

export async function signOut() {
  const supabase = createClient();
  const { error } = await supabase.auth.signOut();

  if (!error) {
    revalidatePath("/login", "page");
    redirect("/login");
  } else {
    console.log("Error logout : ", error);
  }
}