mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-25 16:48:10 -05:00
fix for session promise issue
This commit is contained in:
parent
7b46ddf243
commit
6654362b2c
1 changed files with 14 additions and 14 deletions
|
@ -99,20 +99,20 @@ const handleSessionResponse = (dispatch, body) => {
|
|||
|
||||
module.exports.refreshSession = () => (dispatch => {
|
||||
dispatch(module.exports.setStatus(module.exports.Status.FETCHING));
|
||||
return new Promise((resolve, reject) => (
|
||||
requestSession(resolve, reject).then(body => {
|
||||
handleSessionResponse(dispatch, body);
|
||||
}, err => {
|
||||
dispatch(module.exports.setSessionError(err));
|
||||
})
|
||||
));
|
||||
});
|
||||
|
||||
module.exports.refreshSessionWithRetry = () => (dispatch => {
|
||||
dispatch(module.exports.setStatus(module.exports.Status.FETCHING));
|
||||
return new Promise((resolve, reject) => (
|
||||
requestSessionWithRetry(resolve, reject, 4, 7500)
|
||||
)).then(body => {
|
||||
return new Promise((resolve, reject) => {
|
||||
requestSession(resolve, reject);
|
||||
}).then(body => {
|
||||
handleSessionResponse(dispatch, body);
|
||||
}, err => {
|
||||
dispatch(module.exports.setSessionError(err));
|
||||
});
|
||||
});
|
||||
|
||||
module.exports.refreshSessionWithRetry = () => (dispatch => {
|
||||
dispatch(module.exports.setStatus(module.exports.Status.FETCHING));
|
||||
return new Promise((resolve, reject) => {
|
||||
requestSessionWithRetry(resolve, reject, 4, 7500);
|
||||
}).then(body => {
|
||||
handleSessionResponse(dispatch, body);
|
||||
}, err => {
|
||||
dispatch(module.exports.setSessionError(err));
|
||||
|
|
Loading…
Reference in a new issue