All files / src/store/types auth.types.js

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40      42x         42x         42x                 42x                                  
import NS from './modules.types';
import createFq from './utils';
 
export const AUTH_MUT = Object.freeze({
  setUser: 'SET_USER',
  setLoading: 'SET_LOADING',
});
 
export const AUTH_ACT = Object.freeze({
  hydrate: 'HYDRATE',
  fetchUser: 'FETCH_USER',
});
 
export const AUTH_GET = Object.freeze({
  user: 'user',
  roles: 'roles',
  isAuthenticated: 'isAuthenticated',
  hasRole: 'hasRole',
  can: 'can',
  loading: 'loading',
});
 
export const AUTH_FQ = Object.freeze({
  getters: Object.freeze({
    user: createFq(NS.auth, AUTH_GET.user),
    loading: createFq(NS.auth, AUTH_GET.loading),
    roles: createFq(NS.auth, AUTH_GET.roles),
    isAuthenticated: createFq(NS.auth, AUTH_GET.isAuthenticated),
    hasRole: createFq(NS.auth, AUTH_GET.hasRole),
    can: createFq(NS.auth, AUTH_GET.can),
  }),
  actions: Object.freeze({
    hydrate: createFq(NS.auth, AUTH_ACT.hydrate),
    fetchUser: createFq(NS.auth, AUTH_ACT.fetchUser),
  }),
  mutations: Object.freeze({
    setUser: createFq(NS.auth, AUTH_MUT.setUser),
  }),
});