diff --git a/apps/renderer/src/modules/profile/profile-setting-form.tsx b/apps/renderer/src/modules/profile/profile-setting-form.tsx index 1319b5930..f7ddf63b8 100644 --- a/apps/renderer/src/modules/profile/profile-setting-form.tsx +++ b/apps/renderer/src/modules/profile/profile-setting-form.tsx @@ -10,6 +10,7 @@ import { FormMessage, } from "@follow/components/ui/form/index.jsx" import { Input } from "@follow/components/ui/input/index.js" +import { updateUser } from "@follow/shared/auth" import { cn } from "@follow/utils/utils" import { zodResolver } from "@hookform/resolvers/zod" import { useMutation } from "@tanstack/react-query" @@ -19,7 +20,6 @@ import { toast } from "sonner" import { z } from "zod" import { setWhoami, useWhoami } from "~/atoms/user" -import { apiClient } from "~/lib/api-fetch" import { toastFetchError } from "~/lib/error-parser" const formSchema = z.object({ @@ -48,9 +48,12 @@ export const ProfileSettingForm = ({ }) const updateMutation = useMutation({ - mutationFn: async (values: z.infer) => - apiClient["auth-app"]["update-account"].$patch({ - json: values, + mutationFn: (values: z.infer) => + updateUser({ + // @ts-expect-error + handle: values.handle, + image: values.image, + name: values.name, }), onError: (error) => { toastFetchError(error) diff --git a/packages/shared/src/auth.ts b/packages/shared/src/auth.ts index f3a992c5a..32b522d00 100644 --- a/packages/shared/src/auth.ts +++ b/packages/shared/src/auth.ts @@ -21,7 +21,7 @@ const authClient = createAuthClient({ plugins: serverPlugins, }) -export const { signIn, signOut, getSession, getProviders, createSession } = authClient +export const { signIn, signOut, getSession, getProviders, createSession, updateUser } = authClient export const LOGIN_CALLBACK_URL = `${WEB_URL}/login` export type LoginRuntime = "browser" | "app"