blob: f0b0eb59fa8e4b9590236c1d00ed36534ba71fc1 (
plain)
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
|
import api from '@/store/api';
import i18n from '@/i18n';
const SyslogStore = {
namespaced: true,
state: { settings: {} },
getters: { settings: (state) => state.settings },
mutations: {
saveSettings: (state, data) => (state.settings = data),
},
actions: {
async saveSettings({ dispatch }, payload) {
return await api
.post('/redfish/v1/Syslog/Actions/Syslog.UpdateConfig', payload)
.then(async () => {
await dispatch('getSettings');
return i18n.t('pageTransfer.syslog.saveSettingsSuсcess');
})
.catch((error) => {
console.log(error);
throw new Error(i18n.t('pageTransfer.syslog.saveSettingsError'));
});
},
async getSettings({ commit }) {
return await api
.get('/redfish/v1/Syslog')
.then(({ data: { Configuration = {} } = {} }) => {
commit('saveSettings', Configuration);
})
.catch((error) => console.log(error));
},
},
};
export default SyslogStore;
|