aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/store/StudipStore.js
blob: 7c404a4f18b9037f094b2f2d1b24c9698fccc4cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { eventBus, store } from '../../assets/javascripts/chunks/vue';

const studipStore = {
    namespaced: true,

    state() {
        return { ...STUDIP.config, consumeMode: false };
    },
    getters: {
        getConfig: (state) => (key) => {
            if (state[key] === undefined) {
                throw new Error(`Invalid access to unknown configuration item "${key}"`);
            }
            return state[key];
        },
    },
};

// Make the current state of "focus mode" (fullscreen) available to Vue components.
eventBus.on('switch-focus-mode', (mode) => {
    store.state.studip.consumeMode = mode;
});

export default studipStore;