-1
Well I built an API for registrations in the remote mongodb database (Atlas), I can register, the intention is to offer a form for the user data(Name, Cpf, phone) and then do the CPF, made the login the user should be directed to a page (Dashboard) with the user name and its data.
In Insomnia, I pick up Cpf via req.body {"cpf":"241545444"}
and it works, returns my user with that Cpf, because I used user.findOne({req.body.cpf})
to filter the first user with that CPF:
The problem is when I try to make that data appear on the frontend with Reactjs,
I used Axios to request the Api, I set up the Login dialog, and ask to return the user data based on the input data (Cpf), I store this data in State and Setstate but this data is not compared with that of the api and returns a requeste.data null
...
How do I get the inout Cpf to compare to the one in the api and returns an object as shown in Inuit ???
In Backend I’m using the core
express().use(cors())
. Such that I am registering users by the interface made with Reactjs using the api, I’m just not able to do the login part.– Mateus Cazuza