21 lines
445 B
TypeScript
21 lines
445 B
TypeScript
import { revalidatePath } from "next/cache";
|
|
import { NextRequest } from "next/server";
|
|
import { logout } from "../actions";
|
|
|
|
const dynamic = 'force-dynamic'
|
|
|
|
export async function POST(request: NextRequest) {
|
|
await logout()
|
|
revalidatePath('/login')
|
|
const response = {
|
|
success: true,
|
|
message: 'Logged out successfully',
|
|
};
|
|
|
|
return new Response(JSON.stringify(response), {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
}
|