2016-10-01 127 views
0

如何不在控制檯中打印消息401(未授權)?如何不在控制檯中打印消息401(未授權)?

enter image description here

當用戶不通知憑據正確我不希望在控制檯打印錯誤(401(未授權))。我已經在對待這個錯誤。但他繼續出現。

我的代碼

------------- ------------- auth.service.ts

login(user: User) { 
 

 
    return this.http.post(this.config.getBaseUrl()+'oauth/token', user, this.config.getHeader()) 
 
     .map(res => res.json()); 
 

 
    }

------------- ------------- login.component.ts

login() { 
 
    this.authService.login(this.user).subscribe(
 
      result => console.log(result), 
 
      error => console.log(error) 
 
    );

回答

0

這不是角度做的事情。它是瀏覽器的一項功能。您無法通過更改客戶端代碼來刪除它。

+0

瞭解它 我不會爲這個錯誤而煩惱。 認爲角度解決這個錯誤。 謝謝! –