第二次Angular 7中调用api时拦截器未捕获

时间:2019-06-19 08:29:56

标签: api angular7 interceptor logout

我已登录并注销。在第一次登录时,当我输入错误的用户名或密码时,拦截器将捕获错误并将其抛出。但是成功登录后,我注销了。 接下来,我输入正确的OLD用户名,但输入错误,拦截器未捕获任何内容并成功通过了我的登录。

我的问题类似于How to remove header authentication while logout?,但似乎还没有答案

我的登录名

someusecase.html

我的注销

  public logIn(username: string, password: string): Observable<any> {
    const url = apiConfig.logIn.url;
    const params = new HttpParams()
      .set('grant_type', 'password');
    const headers = new HttpHeaders()
      .set('username', username)
      .set('password', password);

    return this._http.get(url, {params, headers});
  }

预期:第二次使用正确的OLD用户名,错误的密码登录时,拦截器捕获错误

0 个答案:

没有答案