This commit is contained in:
Ivan Rezchikov
2026-07-11 21:20:57 +03:00
parent e192717466
commit 18161f4604
57 changed files with 1211 additions and 615 deletions
+5 -1
View File
@@ -9,7 +9,7 @@ import { deleteUser, updateUser } from "./repository";
import { getAccessToken } from "@/lib/auth/tokens";
import { fetchKotosoftUser } from "@/lib/kotosoft/client";
import { revalidatePath } from "next/cache";
import { getCurrentUser } from "../user";
import { getCurrentUser, getUser } from "../user";
import { runAction } from "@/lib/run-action";
import { AppError, type ActionResult } from "@/lib/action-result";
@@ -61,6 +61,10 @@ export async function updateUserAction(): Promise<ActionResult> {
const userId = await getSessionUserId();
if (!userId) throw new AppError("Not authenticated");
const user = await getUser(userId);
if (user?.kotosoftId !== kotosoftUser.id) throw new AppError("Your session does not match your Kotosoft ID account");
await updateUser(userId, {
email: kotosoftUser.email,
firstName: kotosoftUser.first_name,