Skip to content

Commit

Permalink
Update status of response accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
dangngocquan committed Aug 28, 2023
1 parent 61411fa commit 39613e4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/controllers/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,20 @@ async function loginAccount(req, res, next) {
await serviceHistoryLogins.insertHistory(account.id);

// Return response to client
res.send(JSON.stringify({
"status": 1,
res.status(200).send(JSON.stringify({
"message": "Login account successful.",
"token": token
}));
} else {
res.send(JSON.stringify({
"status": 0,
res.status(200).send(JSON.stringify({
"message": "Username or password incorrect.",
"token": null
}));
}
} catch (err) {
console.error("Error while login account. ", err.message);
res.type('json');
res.send(JSON.stringify({
"status": 0,
res.status(500).send(JSON.stringify({
"message": "Login account failed."
}));
next(err);
Expand Down

0 comments on commit 39613e4

Please sign in to comment.