Files
backerup-website/frontend/app/api/admin/links/[key]/route.ts
T
Anders Böttcher 984b282a95 feat: add admin links management and updaterup page
- Implemented AdminLinksPage for managing link entries with admin role check.
- Created API routes for fetching, updating, and deleting link entries.
- Added ProductTabs component for navigation between Backerup and Updaterup.
- Developed UpdaterupPage with detailed features, setup instructions, and statistics.
- Introduced links database functionality for runtime-editable link overrides.
2026-05-13 10:53:21 +02:00

23 lines
660 B
TypeScript

import { NextResponse } from 'next/server'
import { getSession } from '@/lib/session'
import { resetLink, type LinkKey } from '@/lib/links-db'
import { LINKS } from '@/lib/links'
export async function DELETE(
_request: Request,
{ params }: { params: Promise<{ key: string }> },
) {
const session = await getSession()
if (!session || session.role !== 'admin') {
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
}
const { key } = await params
if (!(key in LINKS)) {
return NextResponse.json({ error: 'Unknown link key' }, { status: 400 })
}
await resetLink(key as LinkKey)
return NextResponse.json({ ok: true })
}