I am trying to implement some code based on HTTP status code in success response using AXIOS call , How can i access the status code of HTTP response header , and redirect to ano
ther component in vu3
Asked
Active
Viewed 425 times
-1
ahmed alsumairi
- 39
- 1
- 4
-
Please post formatted text instead of pictures of formatted text. There’s no need to parse what is already a number. Note that the docs are your friend; this is in the Axios docs. – Dave Newton May 08 '22 at 14:05
2 Answers
0
Assuming your code is something like. const response = await axios.post("<url>"); You can check with if (response.status === 200). Read the full response schema here.
Han Moe Htet
- 692
- 1
- 6
- 10
0
you can use response.status to tap into the status code
response.status
app.get("/",(req,res)=> {
//your code
console.log(response.status);//this will console the status of the request
});
Fadedrifleman
- 197
- 2
- 12