mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Move checkFetchStatus into NodelHelper
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
const FetcherHelper = {
|
||||
checkStatus: function (response) {
|
||||
// response.status >= 200 && response.status < 300
|
||||
if (response.ok) {
|
||||
return response;
|
||||
} else {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = FetcherHelper;
|
@@ -113,6 +113,15 @@ const NodeHelper = Class.extend({
|
||||
}
|
||||
});
|
||||
|
||||
NodeHelper.checkFetchStatus = function (response) {
|
||||
// response.status >= 200 && response.status < 300
|
||||
if (response.ok) {
|
||||
return response;
|
||||
} else {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
};
|
||||
|
||||
NodeHelper.create = function (moduleDefinition) {
|
||||
return NodeHelper.extend(moduleDefinition);
|
||||
};
|
||||
|
Reference in New Issue
Block a user