Line data Source code
1 : // @ts-check 2 : 3 : import { assign, merge } from 'lodash'; 4 : import Vuex from 'vuex'; 5 : import Vue from 'vue'; 6 : import { 7 : sources as baseSources, 8 : createStore, 9 : storeOptions } from '@cern/base-vue'; 10 : import CAMSource from "./sources/CAMSource"; 11 : import CAMModule from "./modules/cameras"; 12 : 13 1 : Vue.use(Vuex); 14 : 15 1 : merge(storeOptions, 16 : /** @type {V.StoreOptions<AppStore.State>} */({ 17 : /* NOTE: declare your store and modules here */ 18 : state: { 19 : user: null, 20 : loading: false, 21 : page: null 22 : }, 23 : mutations: { 24 : update: assign 25 : }, 26 : getters: { 27 0 : isOperator(state) { return (state?.user?.cern_roles ?? []).includes("operator"); }, 28 0 : isExpert(state) { return (state?.user?.cern_roles ?? []).includes("expert"); } 29 : }, 30 : modules: { 31 : cameras: CAMModule 32 : } 33 : }) 34 : ); 35 : 36 1 : const store = createStore(); 37 : 38 : export default store; 39 : 40 1 : export const sources = merge(baseSources, { 41 : cam: new CAMSource(store) 42 : }); 43 : 44 1 : store.sources = sources;