All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 0s
21 lines
690 B
TypeScript
21 lines
690 B
TypeScript
"use server";
|
|
|
|
import { userSchema } from "@/lib/validation/zod/user";
|
|
import { api } from "@/trpc/server";
|
|
import { revalidatePath } from "next/cache";
|
|
import { z } from "zod";
|
|
|
|
export async function updateUserProfile(profile: z.infer<typeof userSchema>) {
|
|
const [result] = await api.users.updateProfile({ profile });
|
|
if (!result?.id) return { success: false };
|
|
revalidatePath("/me");
|
|
return { success: true };
|
|
}
|
|
|
|
export async function setUserPermissions(userId: string, permission: number) {
|
|
const result = await api.users.setPermission({ userId, permission });
|
|
if (!result[0]?.id) return { success: false };
|
|
revalidatePath("/admin/benutzer");
|
|
return { success: true };
|
|
}
|