Skip to content

Commit

Permalink
chore: cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
esteban committed Jun 19, 2021
1 parent 4960121 commit 8e59b54
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,10 @@ app.get("/api/users/:username", async (req, res, next) => {
userNamePlayDetailsPromise
]

const allSettled = promises =>
Promise.all(promises.map(promise => promise
.then(value => ({ state: 'fulfilled', value }))
.catch(reason => ({ state: 'rejected', reason }))
));

const variableArray = [
"allUsers", "userFriendsDetails", "allUsersPlayInfo", "userNamePlayDetails"
]

Promise.allSettled(promises).
then((results) => console.log(results?.value));


// generate header
const lazyBody = () => ({
username: username,
Expand All @@ -93,6 +83,11 @@ app.get("/api/users/:username", async (req, res, next) => {
uri: URIFactory(username)
})


Promise.allSettled(promises).
then((results) => console.log(results?.value));


res.status(200).json(lazyBody());
});

Expand Down

0 comments on commit 8e59b54

Please sign in to comment.