Closed resting closed 7 years ago
I did more tests and found that actually it doesn't delete the cookie in a subscribe method. Any idea why?
this.myAccountService.changePassword(this.password, this.newpassword)
.subscribe(
d => {
this.cookieService.delete('authToken'); // <-- not deleting
},
e => this.onError(e)
)
It doesn't delete either when I do a redirect with router.navigate
.
I found the issue.
I didn't set the path when setting or deleting the cookie.
After setting the path to /
, it is deleting fine now.
Trying to do
this.cookieService.delete('authToken');
in alogin.service
but it doesn't delete.deleteAll()
doesn't work either.But injecting
cookieService
in component works. Any idea?