16 lines
530 B
TypeScript
16 lines
530 B
TypeScript
import { clearMemberCookie, jsonResponse, memberApiFetch } from '../../../_lib/api';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function DELETE(): Promise<Response> {
|
|
const res = await memberApiFetch('/my/account', { method: 'DELETE' });
|
|
if (res.status === 204) {
|
|
return new Response(null, {
|
|
status: 204,
|
|
headers: { 'Set-Cookie': clearMemberCookie() },
|
|
});
|
|
}
|
|
const body = await res.json().catch(() => ({}));
|
|
return jsonResponse(body, res.status, { 'Set-Cookie': clearMemberCookie() });
|
|
}
|