Skip to content

Commit

Permalink
fix: handle logout reason
Browse files Browse the repository at this point in the history
  • Loading branch information
darkoatanasovski committed Jun 7, 2023
1 parent 19748e7 commit a6636a1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/stores/NotificationsController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAccount, reloadActiveSubscription } from './AccountController';
import { logout, reloadActiveSubscription } from './AccountController';

import useService from '#src/hooks/useService';
import { addQueryParams } from '#src/utils/formatting';
Expand Down Expand Up @@ -26,8 +26,10 @@ export const subscribeToNotifications = async (uuid: string = '') => {
window.location.href = addQueryParams(window.location.href, { u: 'payment-error', message: notification.resource?.message });
break;
case NotificationsTypes.ACCOUNT_LOGOUT:
await getAccount();
window.location.href = addQueryParams(window.location.href, { u: 'simultaneous-logins' });
if (notification.resource?.reason === 'sessions_limit') {
window.location.href = addQueryParams(window.location.href, { u: 'simultaneous-logins' });
}
await logout();
break;
case NotificationsTypes.ACCESS_GRANTED:
await reloadActiveSubscription();
Expand Down

0 comments on commit a6636a1

Please sign in to comment.