Service.ts
Upon invoking this function, I receive a JSON response similar to the following:
public signupuser(user: Users): Observable<boolean> {
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let body = user;
return this.http.post(Api.getUrl(Api.URLS.signup), body, {
})
.pipe(map((response: Response) => {
console.log('response', response)
return true;
}));
}
JSON:
response {
"email": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="295c5a4c5b5d4c5a5d694e44484045074a4644">[email protected]</a>",
"nome": "user",
"cognome": "test",
"abbonato": 0,
"cityid": "22",
"msg": "Registered correctly."
}
When testing in Postman, I consistently receive a status code of 200 OK or an error status.
https://i.sstatic.net/icVa7.png
In case the status code is not present in the JSON response, my question would be - how can I interpret and handle it within the code?
Please share any insights you have on this matter.
Update:
How do I access and utilize the X-JWT provided in the header as shown https://i.sstatic.net/LfVNf.png