From eadbcd61e487df9e375b09be0d5785f334113482 Mon Sep 17 00:00:00 2001 From: Rajpreet0 Date: Mon, 28 Sep 2026 20:26:14 +0200 Subject: [PATCH] see comments --- modules/shared/actions/credentials.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/shared/actions/credentials.ts b/modules/shared/actions/credentials.ts index 5d806e2..e09a8a6 100644 --- a/modules/shared/actions/credentials.ts +++ b/modules/shared/actions/credentials.ts @@ -3,6 +3,7 @@ import * as z from "zod"; import { revalidatePath } from "next/cache"; import { createAdminClient } from "@/lib/supabase/admin"; +import { createClient } from "@/lib/supabase/server"; import { verifySession } from "@/lib/supabase/dal"; async function resolveClientId(profileId: string) { @@ -55,7 +56,7 @@ export async function createCredential( return { error: "Client hat noch keine Stammdaten hinterlegt." }; } - const supabase = createAdminClient(); + const supabase = await createClient(); const { error } = await supabase.rpc("create_credential", { p_client_id: clientId, p_service: validatedFields.data.service, @@ -106,7 +107,7 @@ export async function updateCredential( return { error: firstError ?? "Bitte alle Felder ausfüllen." }; } - const supabase = createAdminClient(); + const supabase = await createClient(); const { error } = await supabase.rpc("update_credential", { p_id: validatedFields.data.credentialId, p_service: validatedFields.data.service, @@ -125,7 +126,7 @@ export async function updateCredential( export async function revealCredential(credentialId: string): Promise<{ password: string } | { error: string }> { await verifySession(); - const supabase = createAdminClient(); + const supabase = await createClient(); const { data, error } = await supabase.rpc("reveal_credential", { p_id: credentialId }); if (error || typeof data !== "string") {