diff --git a/web/src/components/UpdateAccountDialog.tsx b/web/src/components/UpdateAccountDialog.tsx index b4b34e3f..cedbb6ee 100644 --- a/web/src/components/UpdateAccountDialog.tsx +++ b/web/src/components/UpdateAccountDialog.tsx @@ -1,6 +1,6 @@ -import { Button } from "@mui/joy"; +import { Button, Input } from "@mui/joy"; import { isEqual } from "lodash-es"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { toast } from "react-hot-toast"; import { convertFileToBase64 } from "@/helpers/utils"; import useCurrentUser from "@/hooks/useCurrentUser"; @@ -31,10 +31,6 @@ const UpdateAccountDialog: React.FC = ({ destroy }: Props) => { email: currentUser.email, }); - useEffect(() => { - // do nth - }, []); - const handleCloseBtnClick = () => { destroy(); }; @@ -97,18 +93,18 @@ const UpdateAccountDialog: React.FC = ({ destroy }: Props) => { try { const updateMask = []; - if (!isEqual(currentUser.avatarUrl, state.avatarUrl)) { - updateMask.push("avatar_url"); + if (!isEqual(currentUser.name.replace(UserNamePrefix, ""), state.username)) { + updateMask.push("username"); } if (!isEqual(currentUser.nickname, state.nickname)) { updateMask.push("nickname"); } - if (!isEqual(currentUser.name.replace(UserNamePrefix, ""), state.username)) { - updateMask.push("username"); - } if (!isEqual(currentUser.email, state.email)) { updateMask.push("email"); } + if (!isEqual(currentUser.avatarUrl, state.avatarUrl)) { + updateMask.push("avatar_url"); + } await userStore.updateUser( UserPb.fromPartial({ name: currentUser.name, @@ -123,7 +119,7 @@ const UpdateAccountDialog: React.FC = ({ destroy }: Props) => { handleCloseBtnClick(); } catch (error: any) { console.error(error); - toast.error(error.response.data.error); + toast.error(error.details); } }; @@ -139,7 +135,7 @@ const UpdateAccountDialog: React.FC = ({ destroy }: Props) => {
{t("common.avatar")} {state.avatarUrl && ( @@ -155,19 +151,19 @@ const UpdateAccountDialog: React.FC = ({ destroy }: Props) => {

{t("common.username")} - {t("setting.account-section.username-note")} + ({t("setting.account-section.username-note")})

- +

{t("common.nickname")} - {t("setting.account-section.nickname-note")} + ({t("setting.account-section.nickname-note")})

- +

{t("common.email")} - {t("setting.account-section.email-note")} + ({t("setting.account-section.email-note")})

- +