19 lines
536 B
TypeScript
19 lines
536 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import { auth } from '@/lib/auth'
|
|
import { prisma } from '@innungsapp/shared'
|
|
import { headers } from 'next/headers'
|
|
|
|
export async function POST() {
|
|
const session = await auth.api.getSession({ headers: await headers() })
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: 'Nicht eingeloggt' }, { status: 401 })
|
|
}
|
|
|
|
await prisma.user.update({
|
|
where: { id: session.user.id },
|
|
data: { mustChangePassword: false },
|
|
})
|
|
|
|
return NextResponse.json({ success: true })
|
|
}
|