Issue with Observable in Metronic Theme Angular 8
I have encountered an error while using the auth service in another component of the Metronic Theme for Angular 8. The same service works without any errors in the default logic component.
this.auth
.login(authData.email, authData.password)
.pipe(
tap(user => {
console.log(user);
if (user) {
this.store.dispatch(new Login({authToken: user.accessToken}));
this.router.navigateByUrl(this.returnUrl); // Main page
} else {
this.authNoticeService.setNotice(this.translate.instant('AUTH.VALIDATION.INVALID_LOGIN'), 'danger');
}
}),
takeUntil(this.unsubscribe),
finalize(() => {
this.loading = false;
this.cdr.markForCheck();
})
)
.subscribe();
}
Error Message :
ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
at subscribeTo (subscribeTo.js:28)
at subscribeToResult (subscribeToResult.js:15)
at TakeUntilOperator.push../node_modules/rxjs/_esm5/internal/operators/takeUntil.js.TakeUntilOperator.call (takeUntil.js:14)
at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:24)
at FinallyOperator.push../node_modules/rxjs/_esm5/internal/operators/finalize.js.FinallyOperator.call (finalize.js:13)
at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe (Observable.js:24)
at AuthComponent.push../src/app/views/pages/auth/auth.component.ts.AuthComponent.submit (auth.component.ts:176)
at Object.eval [as handleEvent] (AuthComponent.html:63)
at handleEvent (core.js:29239)
at callWithDebugContext (core.js:30309)
AuthComponent.html:63 ERROR CONTEXT
DebugContext_ {view: {…}, nodeIndex: 102, nodeDef: {…}, elDef: {…}, elView: {…}}
View_AuthComponent_0 @ AuthComponent.html:63
proxyClass @ compiler.js:20830
push../node_modules/@angular/core/fesm5/core.js.DebugContext_.logError @ core.js:30271
push../node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:4055
dispatchEvent @ core.js:19863
(anonymous) @ core.js:28448
(anonymous) @ platform-browser.js:1032
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:423
onInvokeTask @ core.js:26247
push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:422
push../node_modules/zone.js/dist/zone.js.Zone.runTask @ zone.js:195
push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask @ zone.js:498
invokeTask @ zone.js:1693
globalZoneAwareCallback @ zone.js:1719
Please assist me with resolving this issue.