Tab Removal & Check Abstraction

Per Jessop's request: https://github.com/lbryio/spee.ch/pull/1011#pullrequestreview-243975520
Corrected tabs and added the clarified abstraction to the request state check.
This commit is contained in:
ProfessorDey 2019-05-31 00:15:27 +01:00 committed by GitHub
parent 82ab3b47b1
commit 8a6cd2db13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,16 +22,16 @@ export const makePublishRequestChannel = (fd, isUpdate) => {
xhr.upload.addEventListener('load', onLoad);
// set state change handler
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
switch (xhr.status) {
case 413:
emitter({error: new Error("Unfortunately it appears this web server " +
"has been misconfigured, please inform the service administrators " +
"that they must set their nginx/apache request size maximums higher " +
"than their file size limits.")});
emitter(END);
break;
case 200:
if (xhr.readyState === XMLHttpRequest.DONE) {
switch (xhr.status) {
case 413:
emitter({error: new Error("Unfortunately it appears this web server " +
"has been misconfigured, please inform the service administrators " +
"that they must set their nginx/apache request size maximums higher " +
"than their file size limits.")});
emitter(END);
break;
case 200:
var response = JSON.parse(xhr.response);
if (response.success) {
emitter({success: response});
@ -40,12 +40,12 @@ export const makePublishRequestChannel = (fd, isUpdate) => {
emitter({error: new Error(response.message)});
emitter(END);
}
break;
default:
emitter({error: new Error("Received an unexpected response from " +
break;
default:
emitter({error: new Error("Received an unexpected response from " +
"server: " + xhr.status)});
emitter(END);
}
emitter(END);
}
}
};
// open and send