Initial commit: Wedding Hall Automation System with Next.js, Supabase, and Modern UI
This commit is contained in:
21
src/app/dashboard/settings/packages/new/actions.ts
Normal file
21
src/app/dashboard/settings/packages/new/actions.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
'use server'
|
||||
|
||||
import { createClient } from "@/lib/supabase/server"
|
||||
import { revalidatePath } from "next/cache"
|
||||
|
||||
export async function createPackage(data: { name: string; price: number; description?: string; is_active: boolean }) {
|
||||
const supabase = await createClient()
|
||||
|
||||
const { error } = await supabase.from('packages').insert({
|
||||
name: data.name,
|
||||
price: data.price,
|
||||
description: data.description,
|
||||
is_active: data.is_active,
|
||||
})
|
||||
|
||||
if (error) {
|
||||
throw new Error(error.message)
|
||||
}
|
||||
|
||||
revalidatePath('/dashboard/settings/packages')
|
||||
}
|
||||
Reference in New Issue
Block a user