-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
role.provider not working in production mode #2544
Comments
Observable string = missing. |
Can someone help me???? I'm still stuck with this error!!! |
Are there any updates? I'm facing the same issue. |
Still wating for an answer, tought I was the only with that problem. |
Hello @RoWEN-FCUB, I had this same problem, and the solution for me was to change the import path of the rxjs map.. |
Someone in another post gave me another solution and it's working now, this is my code:
|
This is my role.provider.ts:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operators/map';
import { NbAuthService, NbAuthJWTToken } from '@nebular/auth';
import { NbRoleProvider } from '@nebular/security';
@Injectable()
export class RoleProvider implements NbRoleProvider {
constructor(private authService: NbAuthService) {
}
getRole(): Observable {
return this.authService.onTokenChange()
.pipe(
map((token: NbAuthJWTToken) => {
// console.log(token.getPayload());
return token.isValid() ? token.getPayload()['role'] : 'guest';
}),
);
}
}
It works fine while in development mode (ng serve and ng build), but when I use it in production mode (ng serve --prod and ng build --prod) I get the error:
ERROR TypeError: Object(...) is not a function
getRole http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
set http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
xa http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
ra http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
zs http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
template http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
Xi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
va http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
va http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
va http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
va http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
qi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
Gi http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
_a http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
a http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
next http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
onInvoke http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
next http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
o http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
Vd http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
onHasTask http://localhost:4200/main.c8da7df94aad960dcfeb.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
b http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
promise callback* http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
onScheduleTask http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
value http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
R http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
P http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
x http://localhost:4200/polyfills.a9fe93f4256a69196a00.js:1
r http://localhost:4200/runtime.1f7c745dcecd1542e20e.js:1
http://localhost:4200/5.c3b7e62258abfb184f47.js:1
The text was updated successfully, but these errors were encountered: