First commit

This commit is contained in:
Randa Firman Putra
2025-06-18 22:03:32 +07:00
parent 852121be46
commit e028039ee2
123 changed files with 17506 additions and 144 deletions

View File

@@ -0,0 +1,28 @@
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
export async function POST() {
try {
const response = NextResponse.json(
{ message: 'Logout berhasil' },
{ status: 200 }
);
// Clear the token cookie with additional security options
response.cookies.set('token', '', {
expires: new Date(0),
path: '/',
httpOnly: true,
secure: false,
sameSite: 'lax'
});
return response;
} catch (error) {
console.error('Logout error:', error);
return NextResponse.json(
{ error: 'Terjadi kesalahan saat logout' },
{ status: 500 }
);
}
}