mirror of
https://github.com/crater-invoice/crater.git
synced 2026-02-09 12:22:40 -05:00
init crater
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export const loadData = ({ commit, dispatch, state }, id) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.get(`/api/settings/general`).then((response) => {
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const editPreferences = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios.put('/api/settings/general', data).then((response) => {
|
||||
// commit(types.UPDATE_USER, response.data)
|
||||
commit(types.SET_MOMENT_DATE_FORMAT, data.moment_date_format)
|
||||
resolve(response)
|
||||
}).catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const getMomentDateFormat = (state) => state.momentDateFormat
|
||||
@@ -0,0 +1,19 @@
|
||||
import mutations from './mutations'
|
||||
import * as actions from './actions'
|
||||
import * as getters from './getters'
|
||||
|
||||
const initialState = {
|
||||
momentDateFormat: null
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
|
||||
state: initialState,
|
||||
|
||||
getters: getters,
|
||||
|
||||
actions: actions,
|
||||
|
||||
mutations: mutations
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export const SET_MOMENT_DATE_FORMAT = 'SET_MOMENT_DATE_FORMAT'
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export default {
|
||||
[types.SET_MOMENT_DATE_FORMAT] (state, data) {
|
||||
state.momentDateFormat = data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user