Run doNotificationSocketConnect for CoinSwapStatus
This commit is contained in:
parent
a76f4e4dfe
commit
d1e83fcee2
2 changed files with 11 additions and 4 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue