| @@ -38,7 +38,7 @@ class WBNewProjectDialog extends Component { | |||||
| makeArvadosRequest(arvHost, arvToken, | makeArvadosRequest(arvHost, arvToken, | ||||
| '/arvados/v1/groups', { 'method': 'POST', | '/arvados/v1/groups', { 'method': 'POST', | ||||
| 'data': JSON.stringify(group), | 'data': JSON.stringify(group), | ||||
| 'expectedStatus': 202 } | |||||
| 'expectedStatus': [200, 202] } | |||||
| ).then(callback); | ).then(callback); | ||||
| } }> | } }> | ||||
| <div> | <div> | ||||
| @@ -38,10 +38,15 @@ function makeArvadosRequest(arvHost, arvToken, endpoint, params={}) { | |||||
| xhr.onreadystatechange = () => { | xhr.onreadystatechange = () => { | ||||
| if (xhr.readyState !== 4) | if (xhr.readyState !== 4) | ||||
| return; | return; | ||||
| if (xhr.status !== expectedStatus) | |||||
| reject(xhr); | |||||
| else | |||||
| if ((expectedStatus instanceof Array) && | |||||
| expectedStatus.indexOf(xhr.status) !== -1) { | |||||
| accept(xhr); | accept(xhr); | ||||
| } else if (expectedStatus === xhr.status) { | |||||
| accept(xhr); | |||||
| } else { | |||||
| reject(xhr); | |||||
| } | |||||
| }; | }; | ||||
| xhr.send(data); | xhr.send(data); | ||||
| }); | }); | ||||