🛂 security: fix auth token validation flow
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
"use server";
|
||||
|
||||
import { backendFetch } from "@/shared/helpers/backendFetch";
|
||||
import { backendFetch, BackendResponse } from "@/shared/helpers/backendFetch";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export const logout = async () => {
|
||||
const res = await backendFetch("auth/logout", {
|
||||
const res = (await backendFetch("auth/logout", {
|
||||
method: "POST",
|
||||
});
|
||||
})) as BackendResponse;
|
||||
|
||||
if (res.success) {
|
||||
(await cookies()).delete("auth_token");
|
||||
|
||||
Reference in New Issue
Block a user