'accessing response data from subscribe
My api code
app.post('/login',(req,res) => {
if(req.body.username == "test" && req.body.password == "12345") res.json({status:true})
else res.json({status:false,error:"user name or password is incorrect"})
})
my angular code
onSubmit(){
console.log(this.login.value)
this.credential = this.login.value
this.http.post("http://localhost:9001/user/login",this.credential)
.pipe(map(res => {
}))
.subscribe(responseData => {
})
}
if I try to check the response data
.subscribe(responseData => {
if(responseData.status){}
})
it throws
error TS2339: Property 'status' does not exist on type 'void'.
what mistake did I make? can anyone explain
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
