diff --git a/packages/common/src/services/integrations/jwp/JWPAccountService.ts b/packages/common/src/services/integrations/jwp/JWPAccountService.ts index 40718cabc..379dbb19d 100644 --- a/packages/common/src/services/integrations/jwp/JWPAccountService.ts +++ b/packages/common/src/services/integrations/jwp/JWPAccountService.ts @@ -361,8 +361,13 @@ export default class JWPAccountService extends AccountService { logout = async () => { try { - InPlayer.Notifications.unsubscribe(); - await InPlayer.Account.signOut(); + if (InPlayer.Notifications.isSubscribed()) { + InPlayer.Notifications.unsubscribe(); + } + + if (InPlayer.Account.isAuthenticated()) { + await InPlayer.Account.signOut(); + } } catch { throw new Error('Failed to sign out.'); } diff --git a/packages/ui-react/src/components/DeleteAccountModal/DeleteAccountModal.tsx b/packages/ui-react/src/components/DeleteAccountModal/DeleteAccountModal.tsx index 9d93242bb..053f5d3db 100644 --- a/packages/ui-react/src/components/DeleteAccountModal/DeleteAccountModal.tsx +++ b/packages/ui-react/src/components/DeleteAccountModal/DeleteAccountModal.tsx @@ -24,8 +24,8 @@ const DeleteAccountModal = () => { const deleteAccount = useMutation(accountController.deleteAccountData, { onSuccess: async () => { - await accountController.logout(); navigate('/'); + await accountController.logout(); }, onError: () => { setEnteredPassword('');