so im trying to check if the response i get back from a post request is "success".
onClick={ async () => {
const response = await superagent.post(`http://localhost:3000/create/`).send({
author: `${author}`,
title: `${title}`,
body: `${body}`,
tag: `${tag}`,
})
const responseJSON = JSON.stringify(response.text)
console.log(typeof responseJSON)
console.log(responseJSON)
if(responseJSON === "success"){
setError('good')
}else{
setError('error try again')
}
}}
ive console.logged the responseJSON and it shows that the value is infact a string and is "success" but when i compare it to "success" using the === operator it just returns false. why is this?