fix: refresh UserDropdown after update (#1352)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/1349/head^2
Joel Lu 2021-12-19 02:06:05 +11:00 committed by GitHub
parent 94a10992d2
commit 38f762f7b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -97,9 +97,10 @@ function SettingsView(props: ComponentProps<typeof Settings> & { localeProp: str
const { t } = useLocale();
const router = useRouter();
const mutation = trpc.useMutation("viewer.updateProfile", {
onSuccess: () => {
onSuccess: async () => {
showToast(t("your_user_profile_updated_successfully"), "success");
setHasErrors(false); // dismiss any open errors
await utils.invalidateQueries(["viewer.me"]);
},
onError: (err) => {
setHasErrors(true);