feat: global debugMode functions

This commit is contained in:
Matthieu Bessat 2020-08-16 12:55:15 +02:00
parent 676912e97f
commit fbb320fea6
2 changed files with 17 additions and 5 deletions

View file

@ -20,9 +20,21 @@ export default Vue.extend({
created () {
console.log('Using ' + process.env.VUE_APP_BASE_URL)
if (window.localStorage.getItem('associations_condorcet_debug') === 'YES') {
this.$store.commit('SET_DEBUG', true)
// @ts-ignore
window.enableDebug = () => {
this.$store.commit('SET_DEBUG_MODE', true)
window.localStorage.setItem('pagesAssos__debugMode', 'true')
}
// @ts-ignore
window.disableDebug = () => {
this.$store.commit('SET_DEBUG_MODE', false)
window.localStorage.setItem('pagesAssos__debugMode', 'true')
}
const debugMode = window.localStorage.getItem('pagesAssos__debugMode')
this.$store.commit('SET_DEBUG_MODE', debugMode === 'true')
},
data: () => ({})

View file

@ -62,7 +62,7 @@ const defaultState: State = {
email: '',
publicUrl: ''
},
debug: false,
debugMode: false,
validateMain: false,
onMainReady: () => false,
validateMainCallback: (d = false) => d,
@ -84,8 +84,8 @@ const defaultState: State = {
export default new Vuex.Store({
state: defaultState,
mutations: {
SET_DEBUG (state: State, payload) {
state.debug = payload
SET_DEBUG_MODE (state: State, payload) {
state.debugMode = payload
},
SET_TITLE (state: State, payload) {
state.title = payload