import { action, Action, computed, Computed } from 'easy-peasy'; export interface IAuthenticationModel { token: string; } export interface IAuthenticationStore extends IAuthenticationModel { setToken: Action; hasToken: Computed; } const authenticationStore: IAuthenticationStore = { token: '', setToken: action((state, payload) => ({ ...state, token: payload, })), hasToken: computed((state) => !!state.token), }; export default authenticationStore;