TypeError:scheduler.schedule不是函数

问题描述 投票:0回答:1

我不知道我在项目中添加了什么,所有错误都这样记录:

POST http://xx.xx.xx.xx:3000/auth/login 401 (Unauthorized).........................zone-evergreen.js:2845 
TypeError: scheduler.schedule is not a function....................................auth.service.ts:58 
    at Observable._subscribe (throwError.js:7)
    at Observable._trySubscribe (Observable.js:42)
    at Observable.subscribe (Observable.js:28)
    at subscribeToResult (subscribeToResult.js:9)
    at CatchSubscriber.error (catchError.js:38)
    at XMLHttpRequest.onLoad (http.js:2533)
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:41814)
    at ZoneDelegate.invokeTask (zone-evergreen.js:398)
    at Zone.runTask (zone-evergreen.js:167)

这是打印此代码的简单示例:

login(data) {
    return this.http.post<any>(`${this.BASE_URL}/auth/login`, data).pipe(
        catchError(err => {
            console.error(err);
            return throwError(err);
        }
    )).subscribe(res => console.log(res));
}

当我在chrome devtools的网络标签中跟踪网址时,我发现错误消息是从srver发送的。>

我不知道我在项目中添加了什么,所有错误都被记录为POST http://xx.xx.xx.xx:3000 / auth / login 401(未经授权)...... .............. zone-evergreen.js:2845 TypeError:Scheduler ....

angular typescript httpclient
1个回答
0
投票
 catchError(err => {
    console.error(err);
    return throwError(err);
 }
© www.soinside.com 2019 - 2024. All rights reserved.