Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import axios from 'axios'
import logger from '@/logging'
import _ from 'lodash'
export default {
namespaced: true,
state: {
settings: {
raven: {
front_enabled: {
value: false
},
front_dsn: {
value: null
}
}
}
},
mutations: {
settings: (state, value) => {
_.merge(state.settings, value)
}
},
actions: {
// Send a request to the login URL and save the returned JWT
fetchSettings ({commit}) {
return axios.get('instance/settings/').then(response => {
logger.default.info('Successfully fetched instance settings')
let sections = {}
response.data.forEach(e => {
sections[e.section] = {}
})
response.data.forEach(e => {
sections[e.section][e.name] = e
})
commit('settings', sections)
}, response => {
logger.default.error('Error while fetching settings', response.data)
})
}
}
}