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 user = selectUser(state);
|
||||||
const notificationsEnabled = SIMPLE_SITE || user.experimental_ui;
|
const notificationsEnabled = SIMPLE_SITE || user.experimental_ui;
|
||||||
|
|
||||||
|
dispatch(doNotificationSocketConnect(notificationsEnabled));
|
||||||
|
|
||||||
if (notificationsEnabled) {
|
if (notificationsEnabled) {
|
||||||
dispatch(doNotificationSocketConnect());
|
|
||||||
dispatch(doNotificationList());
|
dispatch(doNotificationList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ export const doSocketDisconnect = (url) => (dispatch) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doNotificationSocketConnect = () => (dispatch) => {
|
export const doNotificationSocketConnect = (enableNotifications) => (dispatch) => {
|
||||||
const authToken = getAuthToken();
|
const authToken = getAuthToken();
|
||||||
if (!authToken) {
|
if (!authToken) {
|
||||||
console.error('Unable to connect to web socket because auth token is missing'); // eslint-disable-line
|
console.error('Unable to connect to web socket because auth token is missing'); // eslint-disable-line
|
||||||
|
@ -69,9 +69,15 @@ export const doNotificationSocketConnect = () => (dispatch) => {
|
||||||
const url = `${NOTIFICATION_WS_URL}${authToken}`;
|
const url = `${NOTIFICATION_WS_URL}${authToken}`;
|
||||||
|
|
||||||
doSocketConnect(url, true, (data) => {
|
doSocketConnect(url, true, (data) => {
|
||||||
if (data.type === 'pending_notification') {
|
switch (data.type) {
|
||||||
|
case 'pending_notifications':
|
||||||
|
if (enableNotifications) {
|
||||||
dispatch(doNotificationList());
|
dispatch(doNotificationList());
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case 'swap-status':
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue