update
This commit is contained in:
parent
e987cf6c69
commit
4be9fea9fc
1 changed files with 68 additions and 49 deletions
|
@ -3,78 +3,97 @@ import Vuex from 'vuex'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
export default new Vuex.Store({
|
interface AlertInterface {
|
||||||
state: {
|
color: string;
|
||||||
alert: {
|
text: string;
|
||||||
color: '',
|
enabled: boolean;
|
||||||
text: '',
|
}
|
||||||
enabled: false
|
|
||||||
},
|
interface State {
|
||||||
title: '',
|
alert: AlertInterface;
|
||||||
tags: [],
|
title: string;
|
||||||
data: {
|
tags: any;
|
||||||
name: '',
|
data: any;
|
||||||
tags: [],
|
delegate: any;
|
||||||
descriptionShort: '',
|
debug: boolean;
|
||||||
descriptionLong: '',
|
validateMain: boolean;
|
||||||
thumbnail: {
|
validateMainCallback: any;
|
||||||
key: '',
|
}
|
||||||
contentType: '',
|
|
||||||
location: '',
|
const defaultState: State = {
|
||||||
type: 'thumbnail'
|
alert: {
|
||||||
},
|
color: '',
|
||||||
contacts: {
|
text: '',
|
||||||
facebook: '',
|
enabled: false
|
||||||
twitter: '',
|
|
||||||
instagram: '',
|
|
||||||
website: '',
|
|
||||||
address: '',
|
|
||||||
person: '',
|
|
||||||
email: '',
|
|
||||||
phone: '',
|
|
||||||
peoples: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
delegate: {
|
|
||||||
validationState: 'unaware',
|
|
||||||
admiName: '',
|
|
||||||
email: '',
|
|
||||||
publicUrl: ''
|
|
||||||
},
|
|
||||||
debug: false,
|
|
||||||
validateMain: false,
|
|
||||||
validateMainCallback: (d = false) => d
|
|
||||||
},
|
},
|
||||||
|
title: '',
|
||||||
|
tags: [],
|
||||||
|
data: {
|
||||||
|
name: '',
|
||||||
|
tags: [],
|
||||||
|
descriptionShort: '',
|
||||||
|
descriptionLong: '',
|
||||||
|
thumbnail: {
|
||||||
|
key: '',
|
||||||
|
contentType: '',
|
||||||
|
location: '',
|
||||||
|
type: 'thumbnail'
|
||||||
|
},
|
||||||
|
contacts: {
|
||||||
|
facebook: '',
|
||||||
|
twitter: '',
|
||||||
|
instagram: '',
|
||||||
|
website: '',
|
||||||
|
address: '',
|
||||||
|
person: '',
|
||||||
|
email: '',
|
||||||
|
phone: '',
|
||||||
|
peoples: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delegate: {
|
||||||
|
validationState: 'unaware',
|
||||||
|
admiName: '',
|
||||||
|
email: '',
|
||||||
|
publicUrl: ''
|
||||||
|
},
|
||||||
|
debug: false,
|
||||||
|
validateMain: false,
|
||||||
|
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