为什么在构建angular 9后此错误e.handle...catch不是函数

问题描述

在ng编译后出现问题 在开发环境中没有问题,但是在执行ng build --prod并将发布版本放入服务器之后

以下问题仍然存在

错误TypeError:e.handle(...)。catch不是函数

输入身份验证表单并单击连接的按钮后,此问题会警告

因此错误会通过以下方法警告

    public getAuthenticate(): Observable<any> {
        return this.http.post<any>(this.authUrl,this.body).pipe(retry(1),catchError(this.handleError));
    }

                this.authService
                .getAuthenticate()
                .subscribe((data: any) => {
                     localStorage.setItem('jwt',data.results.jwt);
                     localStorage.setItem('expire_in',data.results.expire_in);

                   const hashPwd = Md5.hashStr((this.loginForm.get('password').value));

                     const payload = {
                         username: this.loginForm.get('login').value,password: hashPwd
                     };
                     this.alertify.setDuration(30);
                     console.log(data.results.jwt);
                     this.authService.login(payload,data.results.jwt).subscribe(
                         next => {
                             if (next) {
                                 window.location.href = '/dashboard';
                             } else {
                                 this.alertify.error('Votre compte est désactivé',true);
                             }
                         },error => {
                             console.log(error);
                             this.alertify.error('Erreur d\'authentification',true);
                         }
                     );
                });


解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)