Skip to content
Advertisement

I can’t take the information of my result of fetch. Promise

When I try to take the result of my API I can’t. my code:

JavaScript

the code that calls the function

JavaScript

the full code:

JavaScript

not return anything. My route works fine. The problem isn’t in the backend.

if I try to delete the async and await, the return is a Promise. If I use the async and await did never return anything. it stays in the validLoginFetch and doesn’t continue. Does someone know what it can be?

Advertisement

Answer

I finded the answer…. we need to refresh the form before send it to fetch… so The problem was the time for refreshing the form, we need to refreshing before send it. To solve this, set to refresh the form on response:

JavaScript

in my case:

resolve put these command before called the function that make the fetch:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement