I have both my node.js app and postgresql database on render running. They are both working fine as expected and all APIs are working fine using postman. However, if I call some APIs like PUT method below it return success but not updating the database table as expected.
Here is my react code
My API code:
export const putDashboardInfo = async (accountid) => {
try {
console.log(“Inside Put Dashboard”, accountid); – Getting response
// const response = await api.put(“/dashboard/putdashboardinfo”, data, {
const response = await api.put(“/dashboard/putdashboardinfo”, {
accountid,
});
// return response.data;
console.log(“before going out”, response); – Getting response
return;
} catch (error) {
throw error;
}
};
My Dashboard code:
useEffect(() => {
const fetchAccountIDAndDashboardInfo = async () => {
try {
// Get accountID using userEmail
const user = await getUserByEmail(userEmail);
const accountid = user.accountid;
setAccountID(accountid);
---- This is successful
await putDashboardInfo(accountid);
console.log("After put API", accountid);
—This is also successful with 200 but table not upddated.
setLoading(false);
} catch (error) {
console.error(error);
setLoading(false);
}
};
I will appreciate any urgent help.