Get user information from API and use it in menu instead of default name and profile image.
- 主要语言
- TypeScript
- 星标
- 25.7k
- 派生
- 7.9k
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Issue type
**I'm submitting a ...** (check one with "x")
* [ ] bug report
* [ ] feature request
* [x] question about the decisions made in the repository
### Issue description
**Current behavior:**
1. Menu display default name and image in menu drop down. http://prntscr.com/ji5hw3.
2. Also on logout, getting 401 unauthorized error as token is not send in header. I need to send token in header (with specific name of header) so that backend can recognize the call.
**Expected behavior:**
1. I want to display login user information in menu. Where and what I've to change so that after login user info store in local storage and that should be used on menu.
2. It should pass token in header saved in local storage. http://prntscr.com/ji5l4a.
**Related code:**
Following is the data received from backend API:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL3V0YWhydW5uaW5nXC9wdWJsaWNcL2FwaVwvbG9naW4iLCJpYXQiOjE1MjYzODkyMTgsImV4cCI6MTUyNjM5MjgxOCwibmJmIjoxNTI2Mzg5MjE4LCJqdGkiOiJaZ1hPSHY2RXN2Ynh0UERaIiwic3ViIjoxLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.cJCmdD5V0cslJcWq4K64dbxyTE1KW3WaR7GCOtxhmQ8",
"token_type": "bearer",
"expires_in": 3600,
"user": {
"id": 1,
"name": "Umair Ali Malik",
"username": "umair.malik",
"email": "umair.malik@purelogics.net",
"phone": null,
"address": null,
"userRole": 1,
"direct1": null,
"direct2": null,
"direct3": null,
"direct4": null,
"createdBy": 0,
"created_at": "2018-05-14 00:00:00",
"updated_at": null
}
}
I've also done following changes to customize auth pages ngx-admin:
1. Copy all source files from https://github.com/akveo/nebular/tree/master/src/framework/auth to 'theme/components/auth'
2. core.module.ts : import { NbAuthModule, NbDummyAuthProvider } from '../@theme/components/auth'; // '@nebular/auth';
3. app-routing.module.ts: import { NbAuthComponent, NbLoginComponent, NbLogoutComponent, NbRegisterComponent, NbRequestPasswordComponent, NbResetPasswordComponent, } from './@theme/components/auth'; //'@nebular/auth';
4. theme.module.ts: import { NbAuthModule } from './components/auth/auth.module'; import { NbEmailPassAuthProvider } from './components/auth/providers/email-pass-auth.provider';
贡献指南
评估
这个 Issue 还没有评估数据。