mirror of
https://github.com/crater-invoice/crater.git
synced 2025-11-01 06:01:08 -04:00
init crater
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
// import * as types from './mutation-types'
|
||||
|
||||
export const loadData = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/settings/company`).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const editCompany = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.post('/api/settings/company', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}).then((response) => {
|
||||
// commit(types.UPDATE_ITEM, response.data)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
export const company = (state) => state.company
|
||||
@ -0,0 +1,19 @@
|
||||
import mutations from './mutations'
|
||||
import * as actions from './actions'
|
||||
import * as getters from './getters'
|
||||
|
||||
const initialState = {
|
||||
company: null
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
||||
state: initialState,
|
||||
|
||||
getters: getters,
|
||||
|
||||
actions: actions,
|
||||
|
||||
mutations: mutations
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
export const SET_COMPANY = 'SET_COMPANY'
|
||||
export const UPDATE_COMPANY = 'UPDATE_COMPANY'
|
||||
@ -0,0 +1,11 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export default {
|
||||
[types.SET_COMPANY] (state, data) {
|
||||
state.company = data.company
|
||||
},
|
||||
|
||||
[types.UPDATE_COMPANY] (state, data) {
|
||||
state.company = data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user