1.0.0
This commit is contained in:
@@ -13,14 +13,12 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
|
||||
const formData = await request.formData();
|
||||
const registrationEnabled = formData.get('registration_enabled') === 'on';
|
||||
|
||||
// Check if setting exists
|
||||
const existingSetting = await db.select()
|
||||
.from(siteSettings)
|
||||
.where(eq(siteSettings.key, 'registration_enabled'))
|
||||
.get();
|
||||
|
||||
if (existingSetting) {
|
||||
// Update
|
||||
await db.update(siteSettings)
|
||||
.set({
|
||||
value: registrationEnabled ? 'true' : 'false',
|
||||
@@ -28,7 +26,6 @@ export const POST: APIRoute = async ({ request, locals, redirect }) => {
|
||||
})
|
||||
.where(eq(siteSettings.key, 'registration_enabled'));
|
||||
} else {
|
||||
// Insert
|
||||
await db.insert(siteSettings).values({
|
||||
id: nanoid(),
|
||||
key: 'registration_enabled',
|
||||
|
||||
Reference in New Issue
Block a user