🥅 fix: handle logout failure warning

This commit is contained in:
2026-02-18 12:27:24 +07:00
parent 4fc87b7134
commit 0c9ca45b36
3 changed files with 16 additions and 9 deletions

View File

@ -2,6 +2,7 @@
import { backendFetch, BackendResponse } from "@/shared/helpers/backendFetch";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
export const logout = async () => {
const res = (await backendFetch("auth/logout", {
@ -9,11 +10,7 @@ export const logout = async () => {
})) as BackendResponse;
if (res.success) {
(await cookies()).delete("auth_token");
return {
success: true,
message: "Logged out successfully",
};
redirect("/auth/logout");
} else {
return {
success: false,