fix: fix user api fetch in user center overview page
1. Fix user api fetch in user center overview page 2. Remove pureFetchDetail to baseStore to support the method for all store Change-Id: I59b6f0a8f5b2f844a718f121708f724787d047f0
This commit is contained in:
parent
0896ebc917
commit
3dc776b68c
@ -21,6 +21,13 @@ import classnames from 'classnames';
|
||||
import styles from './styles.less';
|
||||
|
||||
export class Overview extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
detail: {},
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.fetchData();
|
||||
}
|
||||
@ -29,7 +36,10 @@ export class Overview extends Component {
|
||||
const {
|
||||
user: { user },
|
||||
} = this.props.rootStore;
|
||||
globalUserStore.pureFetchDetail({ id: user.id, silent: false });
|
||||
const detail = await globalUserStore.pureFetchDetail({ id: user.id });
|
||||
this.setState({
|
||||
detail,
|
||||
});
|
||||
}
|
||||
|
||||
renderInfoItem(item) {
|
||||
@ -42,7 +52,7 @@ export class Overview extends Component {
|
||||
}
|
||||
|
||||
renderUserInfo() {
|
||||
const { detail = {} } = globalUserStore;
|
||||
const { detail = {} } = this.state;
|
||||
const data = {
|
||||
[t('Username')]: detail.name || '-',
|
||||
[t('Email')]: detail.email || '-',
|
||||
|
@ -511,6 +511,11 @@ export default class BaseStore {
|
||||
return newData;
|
||||
}
|
||||
|
||||
async pureFetchDetail({ id }) {
|
||||
const result = await this.client.show(id);
|
||||
return result[this.responseKey];
|
||||
}
|
||||
|
||||
@action
|
||||
async fetchDetail({ all_projects, silent, ...rest }) {
|
||||
if (!silent) {
|
||||
|
@ -138,11 +138,6 @@ export class LbaasStore extends Base {
|
||||
return this.detail;
|
||||
}
|
||||
|
||||
async pureFetchDetail({ id }) {
|
||||
const result = await this.client.show(id);
|
||||
return result[this.responseKey];
|
||||
}
|
||||
|
||||
@action
|
||||
delete = ({ id }) =>
|
||||
// TODO: check params;
|
||||
|
Loading…
Reference in New Issue
Block a user