mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
adding theming to client and bug fixes
This commit is contained in:
30
packages/web/src/app/api/theme/route.ts
Normal file
30
packages/web/src/app/api/theme/route.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { getTheme, saveTheme } from "@rahoot/web/server/theme"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
export const runtime = "nodejs"
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const theme = getTheme()
|
||||
return NextResponse.json({ theme })
|
||||
} catch (error) {
|
||||
console.error("Failed to load theme", error)
|
||||
return NextResponse.json({ error: "Failed to load theme" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const body = await request.json()
|
||||
const theme = saveTheme({
|
||||
brandName: body.brandName,
|
||||
backgroundUrl: body.backgroundUrl,
|
||||
})
|
||||
return NextResponse.json({ theme })
|
||||
} catch (error) {
|
||||
console.error("Failed to save theme", error)
|
||||
const message = error instanceof Error ? error.message : "Failed to save theme"
|
||||
return NextResponse.json({ error: message }, { status: 400 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user