修复bug
This commit is contained in:
@@ -42,6 +42,7 @@ export class AppRoutingModule {
|
|||||||
if (!this.userService.userInfo) {
|
if (!this.userService.userInfo) {
|
||||||
this.userService.getUserInfo().subscribe(data => {
|
this.userService.getUserInfo().subscribe(data => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
|
this.userService.userInfo = data.result;
|
||||||
this.checkPermission(event);
|
this.checkPermission(event);
|
||||||
} else if (data.code === 301) {
|
} else if (data.code === 301) {
|
||||||
window.location.href = '/login';
|
window.location.href = '/login';
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ export class UserService {
|
|||||||
avatarHost: string = 'http://cdn.celess.cn';
|
avatarHost: string = 'http://cdn.celess.cn';
|
||||||
|
|
||||||
constructor(public http: HttpService) {
|
constructor(public http: HttpService) {
|
||||||
this.getUserInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userPage: Page<User>[] = [];
|
userPage: Page<User>[] = [];
|
||||||
@@ -24,13 +23,7 @@ export class UserService {
|
|||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
const observable = this.http.get('/user/userInfo');
|
return this.http.get('/user/userInfo');
|
||||||
observable.subscribe((data: any) => {
|
|
||||||
if (data.code === 0) {
|
|
||||||
this.userInfo = data.result;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return observable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user