'use server';
import { deleteToken } from "@/actions/cookies";
import { cookies } from "next/headers";
import postData from "../post-data";

export default async function logout() {
   const { error, message } = await postData({ endPoint: '/logout' });
   if (error) {
      return { error, message };
   }

   await deleteToken();
   cookies().delete('UD');
   return { error, message };
}