weaver_trunk_cli/pc4mobx/hrm/stores/domain/authority.js

26 lines
396 B
JavaScript

import {
observable,
action
} from 'mobx';
export default class AuthorityStore {
constructor(api) {
this.api = api;
}
@observable hasRight = false;
@observable loading = true;
@action fetchAuthority = () => {
return this.api.fetchAuthority().then(datas => {
const {
hasRight
} = datas;
this.hasRight = hasRight;
this.loading = false;
return hasRight;
});
}
}