🚸 ux: improve logout flow completely
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user