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; }); } }