🥅 fix: handle logout failure warning
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user