mirror of
https://github.com/R0m1k3/Menu.git
synced 2026-10-11 17:28:28 +02:00
feat: implement admin dashboard with authentication and title management capabilities
This commit is contained in:
1 parent
d253eff0fa
commit
0bfed1adf2
4 files changed
+115
-1
No files matched your search
@@ -105,3 +105,22 @@ export async function deleteButton(id: number) {
|
||||
revalidatePath('/admin');
|
||||
revalidatePath('/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update global app title.
|
||||
*/
|
||||
export async function updateAppTitle(formData: FormData) {
|
||||
if (!(await isAuthenticated())) throw new Error('Non autorisé');
|
||||
|
||||
const title = formData.get('title') as string;
|
||||
if (!title) throw new Error('Titre requis.');
|
||||
|
||||
await prisma.config.upsert({
|
||||
where: { id: 'app_title' },
|
||||
update: { value: title },
|
||||
create: { id: 'app_title', value: title },
|
||||
});
|
||||
|
||||
revalidatePath('/admin');
|
||||
revalidatePath('/');
|
||||
}
|
||||
Reference in new issue
Block a user