Skip to content

Instantly share code, notes, and snippets.

View imrhlrvndrn's full-sized avatar

Rahul Ravindran imrhlrvndrn

View GitHub Profile
@imrhlrvndrn
imrhlrvndrn / addExpense.js
Last active December 28, 2019 11:36
The first axios post request creates a new expense in the expenses collection and the second axios request in the .then() updates the current balance of the logged user. In the production app the expense is created but the second axios request is not executed and hence the current balance of the user is not updated. Please suggest something to o…
axios
.post("/expense/add", newExpense)
.then(() => {
if (expenseList[0].whatfor === "recharge") {
const updateInfo = {
username: userInfo.username,
email: userInfo.email,
password: userInfo.password,
income: Number(userInfo.income),
expense: Number(userInfo.expense),