16 lines
512 B
TypeScript
16 lines
512 B
TypeScript
import { sessionOptions } from '@/libs/session'
|
|
import { SessionData } from '@/types/Auth'
|
|
import { getIronSession } from 'iron-session'
|
|
import { cookies } from 'next/headers'
|
|
import { NextResponse } from 'next/server'
|
|
|
|
export async function GET(request: Request) {
|
|
const cookieStore = await cookies()
|
|
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
|
|
session.destroy()
|
|
// return redirect('/login')
|
|
|
|
return NextResponse.json({ code: 200, message: 'Logout successful' })
|
|
}
|