17 lines
575 B
TypeScript
17 lines
575 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { redis } from '@/lib/redis'
|
|
|
|
export async function PUT(req: NextRequest, { params }: { params: { id: string } }) {
|
|
try {
|
|
const { id: notificationId } = params
|
|
const { read } = await req.json()
|
|
|
|
await redis.set(`notification:${notificationId}:read`, read ? 'true' : 'false')
|
|
|
|
return NextResponse.json({ success: true })
|
|
} catch (error) {
|
|
console.error('Mark notification read error:', error)
|
|
return NextResponse.json({ error: 'Failed to update notification' }, { status: 500 })
|
|
}
|
|
}
|