see comments

This commit is contained in:
Rajpreet0 2026-09-28 20:26:14 +02:00
parent 59f209d754
commit eadbcd61e4

View file

@ -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") {