remove: reject
This commit is contained in:
parent
9c125996b3
commit
4b14375887
2 changed files with 43 additions and 44 deletions
|
|
@ -1,7 +1,8 @@
|
|||
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
||||
|
||||
function getLatestVersion() {
|
||||
return new Promise((resolve, reject) => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const url = "https://api.github.com/repos/gohugoio/hugo/releases/latest";
|
||||
xhr.open("GET", url);
|
||||
|
|
@ -14,8 +15,8 @@ function getLatestVersion() {
|
|||
const latestVersion = latestURL.match(/(\d+).(\d+).(\d+)/g)[0];
|
||||
|
||||
resolve(latestVersion);
|
||||
} else {
|
||||
reject(`ERROR: got status ${xhr.status}`);
|
||||
// } else {
|
||||
// reject(`ERROR: got status ${xhr.status}`);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue