init crater

This commit is contained in:
Mohit Panjwani
2019-11-11 12:16:00 +05:30
commit bdf2ba51d6
668 changed files with 158503 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import * as types from './mutation-types'
export const submitData = ({ commit, dispatch, state }, data) => {
return new Promise((resolve, reject) => {
window.axios.post('/api/settings/general', data).then((response) => {
// commit(types.SET_CATEGORIES, response.data)
resolve(response)
}).catch((err) => {
reject(err)
})
})
}
export const loadData = ({ commit, dispatch, state }) => {
return new Promise((resolve, reject) => {
window.axios.get('/api/settings/general').then((response) => {
commit(types.SET_INITIAL_DATA, response.data)
resolve(response)
}).catch((err) => {
reject(err)
})
})
}
export const setItemDiscount = ({ commit, dispatch, state }) => {
commit(types.SET_ITEM_DISCOUNT)
}

View File

@ -0,0 +1,2 @@
export const items = (state) => state.items
export const itemDiscount = (state) => state.item_discount

View File

@ -0,0 +1,23 @@
import mutations from './mutations'
import * as actions from './actions'
import * as getters from './getters'
const initialState = {
currencies: null,
time_zones: null,
languages: null,
date_formats: null,
item_discount: false
}
export default {
namespaced: true,
state: initialState,
getters: getters,
actions: actions,
mutations: mutations
}

View File

@ -0,0 +1,2 @@
export const SET_INITIAL_DATA = 'SET_INITIAL_DATA'
export const SET_ITEM_DISCOUNT = 'SET_ITEM_DISCOUNT'

View File

@ -0,0 +1,14 @@
import * as types from './mutation-types'
export default {
[types.SET_INITIAL_DATA] (state, data) {
state.currencies = data.currencies
state.time_zones = data.time_zones
state.languages = data.languages
state.date_formats = data.date_formats
},
[types.SET_ITEM_DISCOUNT] (state) {
state.item_discount = true
}
}