update
This commit is contained in:
parent
e987cf6c69
commit
4be9fea9fc
1 changed files with 68 additions and 49 deletions
|
@ -3,8 +3,24 @@ import Vuex from 'vuex'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
export default new Vuex.Store({
|
interface AlertInterface {
|
||||||
state: {
|
color: string;
|
||||||
|
text: string;
|
||||||
|
enabled: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface State {
|
||||||
|
alert: AlertInterface;
|
||||||
|
title: string;
|
||||||
|
tags: any;
|
||||||
|
data: any;
|
||||||
|
delegate: any;
|
||||||
|
debug: boolean;
|
||||||
|
validateMain: boolean;
|
||||||
|
validateMainCallback: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultState: State = {
|
||||||
alert: {
|
alert: {
|
||||||
color: '',
|
color: '',
|
||||||
text: '',
|
text: '',
|
||||||
|
@ -44,37 +60,40 @@ export default new Vuex.Store({
|
||||||
debug: false,
|
debug: false,
|
||||||
validateMain: false,
|
validateMain: false,
|
||||||
validateMainCallback: (d = false) => d
|
validateMainCallback: (d = false) => d
|
||||||
},
|
}
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: defaultState,
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_DEBUG (state, payload) {
|
SET_DEBUG (state: State, payload) {
|
||||||
state.debug = payload
|
state.debug = payload
|
||||||
},
|
},
|
||||||
SET_TITLE (state, payload) {
|
SET_TITLE (state: State, payload) {
|
||||||
state.title = payload
|
state.title = payload
|
||||||
window.document.title = state.title + ' | Panel forum des associations'
|
window.document.title = state.title + ' | Panel forum des associations'
|
||||||
},
|
},
|
||||||
ADD_ALERT (state, payload) {
|
ADD_ALERT (state: State, payload) {
|
||||||
state.alert = {
|
state.alert = {
|
||||||
color: payload.color,
|
color: payload.color,
|
||||||
text: payload.text,
|
text: payload.text,
|
||||||
enabled: true
|
enabled: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DISABLE_ALERT (state) {
|
DISABLE_ALERT (state: State) {
|
||||||
state.alert.enabled = false
|
state.alert.enabled = false
|
||||||
},
|
},
|
||||||
SET_DATA (state, payload) {
|
SET_DATA (state: State, payload) {
|
||||||
if (payload !== null) {
|
if (payload !== null) {
|
||||||
state.data = { ...state.data, ...payload }
|
state.data = { ...state.data, ...payload }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SET_TAGS (state, payload) {
|
SET_TAGS (state: State, payload) {
|
||||||
state.tags = payload
|
state.tags = payload
|
||||||
},
|
},
|
||||||
SET_DELEGATE (state, payload) {
|
SET_DELEGATE (state: State, payload) {
|
||||||
state.delegate = { ...state.delegate, ...payload }
|
state.delegate = { ...state.delegate, ...payload }
|
||||||
},
|
},
|
||||||
VALIDATE_MAIN (state, callback) {
|
VALIDATE_MAIN (state: State, callback) {
|
||||||
state.validateMain = true
|
state.validateMain = true
|
||||||
state.validateMainCallback = (d: boolean) => {
|
state.validateMainCallback = (d: boolean) => {
|
||||||
state.validateMain = false
|
state.validateMain = false
|
||||||
|
|
Loading…
Reference in a new issue