Hey all, if anyone has the time to help me through this Id appreciate it. I make a get request and the node server reacts accordingly, but when it sends back the data to front end, the front end logs some weird response object instead of my info. Here it isThe Server:users.get('/getUserInformation', (req,res) => {console.log(req.cookies.access_token);const token = req.cookies.access_tokenconst decoded = jwt_decode(token)console.log('checking decoded email',decoded.email);User.findOne({where: {email: decoded.email}}).then(user => {console.log('getting user info for: ', user);res.json({user:user})res.status(200).end()})})And the client:export const getUserInfo = () => {fetch('/users/getUserInformation',{method:'GET',headers: {'Content-Type': 'application/json',},}).then((res)=>{console.log(res);})}And when it runs I get this in the console:https://preview.redd.it/nyps3monmv851.png?width=952&format=png&auto=webp&s=4563733ed5847578b9dec903982fb795e0345a90If anyone has any insight id be greatly appreciative. My node server reacts accordingly to the request and does everything its supposed to
Submitted July 04, 2020 at 06:37PM by CharliePrograms12
No comments:
Post a Comment