From c2d0cfa676eb57602d3bb3c44c6b7965f84b82da Mon Sep 17 00:00:00 2001 From: Maksim Zakharov Date: Fri, 9 Sep 2022 14:10:03 +0300 Subject: smnp-layout --- src/store/index.js | 2 ++ src/store/modules/Settings/SmtpStore.js | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/store/modules/Settings/SmtpStore.js (limited to 'src/store') diff --git a/src/store/index.js b/src/store/index.js index a4dd16ed..ba7cdf99 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -30,6 +30,7 @@ import PoliciesStore from './modules/SecurityAndAccess/PoliciesStore'; import FactoryResetStore from './modules/Operations/FactoryResetStore'; import KeyClearStore from './modules/Operations/KeyClearStore'; import PciStore from './modules/HardwareStatus/PciStore'; +import SmtpStore from './modules/Settings/SmtpStore'; import WebSocketPlugin from './plugins/WebSocketPlugin'; import DateTimeStore from './modules/Settings/DateTimeStore'; @@ -73,6 +74,7 @@ export default new Vuex.Store({ factoryReset: FactoryResetStore, keyClear: KeyClearStore, pciStore: PciStore, + smtpStore: SmtpStore, }, plugins: [WebSocketPlugin], }); diff --git a/src/store/modules/Settings/SmtpStore.js b/src/store/modules/Settings/SmtpStore.js new file mode 100644 index 00000000..ccb0eb48 --- /dev/null +++ b/src/store/modules/Settings/SmtpStore.js @@ -0,0 +1,43 @@ +import api from '@/store/api'; +import i18n from '@/i18n'; + +const SmtpStore = { + namespaced: true, + state: { smtp: {} }, + getters: { smtpSettings: (state) => state.smtp }, + mutations: { + saveSmtpSettings: (state, data) => (state.smtp = data), + }, + actions: { + async setSmtpSettings({ commit }, payload) { + return await api + .get( + `/redfish/v1/Smtp/ChangeParameters/ + &user=${payload.user} + &password=${payload.password} + &host=smtp.${payload.host} + &port=${payload.port}` + ) + .then(() => { + commit('saveSmtpSettings', payload); + return i18n.t('pageTransfer.saveSmtpSuŅcess'); + }) + .catch((error) => { + console.log(error); + throw new Error(i18n.t('pageTransfer.saveSmtpError')); + }); + }, + async sendTestMessage(payload) { + return await api.get( + `redfish/v1/Smtp/SendMail + &from=${payload.from} + &to=${payload.subscribers} + &subject=theme + &text=text + ` + ); + }, + }, +}; + +export default SmtpStore; -- cgit v1.2.3