🚸 ux: improve logout flow completely

This commit is contained in:
2026-02-18 12:53:58 +07:00
parent 0c9ca45b36
commit 39124f0db4
4 changed files with 23 additions and 12 deletions

View File

@ -1,8 +1,6 @@
"use server";
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", {
@ -10,7 +8,10 @@ export const logout = async () => {
})) as BackendResponse;
if (res.success) {
redirect("/auth/logout");
return {
success: true,
message: "Logout successful",
};
} else {
return {
success: false,