From e030fe0e076fc9fd9311e708928d9a1825716ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Tue, 14 May 2024 10:10:41 -0700 Subject: [PATCH] fix: error when unlinking google account (#15011) Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> --- .../web/pages/settings/my-account/profile.tsx | 14 ++-- apps/web/public/static/locales/en/common.json | 2 + .../server/routers/loggedInViewer/_router.tsx | 14 +++- .../unlinkConnectedAccount.handler.spec.ts | 71 +++++++++++++++++++ .../unlinkConnectedAccount.handler.ts | 44 ++++++++++++ .../loggedInViewer/updateProfile.handler.ts | 20 ------ .../loggedInViewer/updateProfile.schema.ts | 1 - 7 files changed, 140 insertions(+), 26 deletions(-) create mode 100644 packages/trpc/server/routers/loggedInViewer/unlinkConnectedAccount.handler.spec.ts create mode 100644 packages/trpc/server/routers/loggedInViewer/unlinkConnectedAccount.handler.ts diff --git a/apps/web/pages/settings/my-account/profile.tsx b/apps/web/pages/settings/my-account/profile.tsx index 14cde6aaea..7b216dd195 100644 --- a/apps/web/pages/settings/my-account/profile.tsx +++ b/apps/web/pages/settings/my-account/profile.tsx @@ -124,6 +124,15 @@ const ProfileView = () => { } }, }); + const unlinkConnectedAccountMutation = trpc.viewer.unlinkConnectedAccount.useMutation({ + onSuccess: async (res) => { + showToast(t(res.message), "success"); + utils.viewer.me.invalidate(); + }, + onError: (e) => { + showToast(t(e.message), "error"); + }, + }); const addSecondaryEmailMutation = trpc.viewer.addSecondaryEmail.useMutation({ onSuccess: (res) => { @@ -439,10 +448,7 @@ const ProfileView = () => {