feat: Upgrade to Next.js 16.1 & React 19.2, migrate to Supabase SSR with async client handling
This commit is contained in:
@@ -1,24 +1,15 @@
|
||||
'use server';
|
||||
|
||||
import { createServerActionClient } from '@supabase/auth-helpers-nextjs';
|
||||
import { cookies } from 'next/headers';
|
||||
import { createClient } from '@/lib/supabase/server';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
|
||||
export async function updateBottle(bottleId: string, data: {
|
||||
name?: string;
|
||||
distillery?: string;
|
||||
category?: string;
|
||||
abv?: number;
|
||||
age?: number;
|
||||
whiskybase_id?: string;
|
||||
purchase_price?: number;
|
||||
distilled_at?: string;
|
||||
bottled_at?: string;
|
||||
batch_info?: string;
|
||||
}) {
|
||||
const supabase = createServerActionClient({ cookies });
|
||||
import { UpdateBottleSchema, UpdateBottleData } from '@/types/whisky';
|
||||
|
||||
export async function updateBottle(bottleId: string, rawData: UpdateBottleData) {
|
||||
const supabase = await createClient();
|
||||
|
||||
try {
|
||||
const data = UpdateBottleSchema.parse(rawData);
|
||||
const { data: { session } } = await supabase.auth.getSession();
|
||||
if (!session) throw new Error('Nicht autorisiert');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user