diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 2e69506fa..069752f99 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -543,8 +543,9 @@ export function doSignIn() { const user = selectUser(state); const notificationsEnabled = SIMPLE_SITE || user.experimental_ui; + dispatch(doNotificationSocketConnect(notificationsEnabled)); + if (notificationsEnabled) { - dispatch(doNotificationSocketConnect()); dispatch(doNotificationList()); } diff --git a/ui/redux/actions/websocket.js b/ui/redux/actions/websocket.js index 5e497fa46..94af728e5 100644 --- a/ui/redux/actions/websocket.js +++ b/ui/redux/actions/websocket.js @@ -59,7 +59,7 @@ export const doSocketDisconnect = (url) => (dispatch) => { } }; -export const doNotificationSocketConnect = () => (dispatch) => { +export const doNotificationSocketConnect = (enableNotifications) => (dispatch) => { const authToken = getAuthToken(); if (!authToken) { console.error('Unable to connect to web socket because auth token is missing'); // eslint-disable-line @@ -69,8 +69,14 @@ export const doNotificationSocketConnect = () => (dispatch) => { const url = `${NOTIFICATION_WS_URL}${authToken}`; doSocketConnect(url, true, (data) => { - if (data.type === 'pending_notification') { - dispatch(doNotificationList()); + switch (data.type) { + case 'pending_notifications': + if (enableNotifications) { + dispatch(doNotificationList()); + } + break; + case 'swap-status': + break; } }); };