Skip to content

Commit

Permalink
Simplify usage of promises
Browse files Browse the repository at this point in the history
  • Loading branch information
Lioness100 committed Mar 27, 2021
1 parent 4992fdb commit 5f50089
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
const axios = require("axios");

const fact = {
async getFact() {
return new Promise(async (resolve, reject) => {
await axios
.get(`https://animu.ml/fact`)
.then(function (response) {
resolve(response.data);
})
.catch((err) => {
return reject(err);
});
});
getFact() {
return axios
.get(`https://animu.ml/fact`)
.then((response) => response.data)
},
};

module.exports = fact;

0 comments on commit 5f50089

Please sign in to comment.