diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-19 17:02:28 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-19 17:02:28 +0300 |
commit | 30f4e9777b157fe7023a9cf02c7d53737d2e2974 (patch) | |
tree | 975f963652021cec858f1c08b3a589432562b770 /src/store/modules/Settings/SyslogStore.js | |
parent | 8a20e665fe0242d8fe075766a7fcfb46b820d12b (diff) | |
download | webui-vue-30f4e9777b157fe7023a9cf02c7d53737d2e2974.tar.xz |
upd syslog and smtp
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; |