I need help on React-native app api not working

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.

Hi there,

We cannot provide much coding advice or support, as it is out of scope for our Support Team and not reflective of an issue with Render itself.

Broadly speaking, our recommendation here is to add more application logging and error handling. Debugging can also unveil many problems.

Beyond that, try reaching out to a community that specializes in your tech stack, or a generalist site like Stack Overflow for these type of questions.

Regards,
Mike


Render Support Engineer, MT (UTC-6, UTC-7 in Winter)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.