diff options
Diffstat (limited to 'src/store/modules/Settings/SyslogStore.js')
-rw-r--r-- | src/store/modules/Settings/SyslogStore.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/store/modules/Settings/SyslogStore.js b/src/store/modules/Settings/SyslogStore.js new file mode 100644 index 00000000..f0b0eb59 --- /dev/null +++ b/src/store/modules/Settings/SyslogStore.js @@ -0,0 +1,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; |