Tambah cookies di bagian verifikasi, agar kedeteksi user sudah regis apa belom

This commit is contained in:
2025-11-27 14:46:49 +08:00
parent c64a2e5457
commit 2cecec733e
8 changed files with 209 additions and 62 deletions

View File

@@ -0,0 +1,19 @@
// app/api/auth/clear-flow/route.ts
import { NextResponse } from 'next/server';
import { cookies } from 'next/headers';
export async function POST() {
try {
// ✅ Next.js 15 syntax
const cookieStore = await cookies();
cookieStore.delete('auth_flow');
return NextResponse.json({ success: true });
} catch (error) {
console.error('❌ Error clearing flow cookie:', error);
return NextResponse.json(
{ success: false, message: 'Internal server error' },
{ status: 500 }
);
}
}