I am sending a request to backend with fetchApi and the response is coming as a just only string (not in a json body)
Here is my frontend code:
async decryptText() {
let response = await this.getDecryptedText(this.entry.text, this.user.userId)
if(response){
console.log(response)
}
}
async getDecryptedText(inputText: string, userId: number) {
let url = "http://localhost:8080/getDecryptedText?textToDecrypt=" + inputText + "&userId=" + userId;
return fetch(url);
}
But I cannot parse the response like other json responses because it is just a string.
When I print it to console the output is this:
I just want to print on to console the response string
How can I get the string response and assign it to a variable ?
I have edited the code as on answers.