Yoshie Muranaka | 224d6ad | 2020-05-21 09:10:52 -0700 | [diff] [blame] | 1 | import api, { getResponseCount } from '@/store/api'; |
| 2 | import i18n from '@/i18n'; |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 3 | |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 4 | const UserManagementStore = { |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 5 | namespaced: true, |
| 6 | state: { |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 7 | allUsers: [], |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 8 | accountRoles: [], |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 9 | accountLockoutDuration: null, |
| 10 | accountLockoutThreshold: null, |
| 11 | accountMinPasswordLength: null, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 12 | accountMaxPasswordLength: null, |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 13 | }, |
| 14 | getters: { |
| 15 | allUsers(state) { |
| 16 | return state.allUsers; |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 17 | }, |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 18 | accountRoles(state) { |
| 19 | return state.accountRoles; |
| 20 | }, |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 21 | accountSettings(state) { |
| 22 | return { |
| 23 | lockoutDuration: state.accountLockoutDuration, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 24 | lockoutThreshold: state.accountLockoutThreshold, |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 25 | }; |
| 26 | }, |
| 27 | accountPasswordRequirements(state) { |
| 28 | return { |
| 29 | minLength: state.accountMinPasswordLength, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 30 | maxLength: state.accountMaxPasswordLength, |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 31 | }; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 32 | }, |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 33 | }, |
| 34 | mutations: { |
| 35 | setUsers(state, allUsers) { |
| 36 | state.allUsers = allUsers; |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 37 | }, |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 38 | setAccountRoles(state, accountRoles) { |
| 39 | state.accountRoles = accountRoles; |
| 40 | }, |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 41 | setLockoutDuration(state, lockoutDuration) { |
| 42 | state.accountLockoutDuration = lockoutDuration; |
| 43 | }, |
| 44 | setLockoutThreshold(state, lockoutThreshold) { |
| 45 | state.accountLockoutThreshold = lockoutThreshold; |
| 46 | }, |
| 47 | setAccountMinPasswordLength(state, minPasswordLength) { |
| 48 | state.accountMinPasswordLength = minPasswordLength; |
| 49 | }, |
| 50 | setAccountMaxPasswordLength(state, maxPasswordLength) { |
| 51 | state.accountMaxPasswordLength = maxPasswordLength; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 52 | }, |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 53 | }, |
| 54 | actions: { |
Yoshie Muranaka | 346be2a | 2020-04-28 11:12:14 -0700 | [diff] [blame] | 55 | async getUsers({ commit }) { |
| 56 | return await api |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 57 | .get('/redfish/v1/AccountService/Accounts') |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 58 | .then((response) => |
| 59 | response.data.Members.map((user) => user['@odata.id']) |
| 60 | ) |
| 61 | .then((userIds) => api.all(userIds.map((user) => api.get(user)))) |
| 62 | .then((users) => { |
| 63 | const userData = users.map((user) => user.data); |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 64 | commit('setUsers', userData); |
Yoshie Muranaka | 74c24f1 | 2019-12-03 10:45:46 -0800 | [diff] [blame] | 65 | }) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 66 | .catch((error) => { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 67 | console.log(error); |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 68 | const message = i18n.t('pageUserManagement.toast.errorLoadUsers'); |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 69 | throw new Error(message); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 70 | }); |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 71 | }, |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 72 | getAccountSettings({ commit }) { |
| 73 | api |
| 74 | .get('/redfish/v1/AccountService') |
| 75 | .then(({ data }) => { |
| 76 | commit('setLockoutDuration', data.AccountLockoutDuration); |
| 77 | commit('setLockoutThreshold', data.AccountLockoutThreshold); |
| 78 | commit('setAccountMinPasswordLength', data.MinPasswordLength); |
| 79 | commit('setAccountMaxPasswordLength', data.MaxPasswordLength); |
| 80 | }) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 81 | .catch((error) => { |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 82 | console.log(error); |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 83 | const message = i18n.t( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 84 | 'pageUserManagement.toast.errorLoadAccountSettings' |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 85 | ); |
| 86 | throw new Error(message); |
Yoshie Muranaka | 52b0223 | 2020-02-20 08:00:45 -0800 | [diff] [blame] | 87 | }); |
| 88 | }, |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 89 | getAccountRoles({ commit }) { |
| 90 | api |
| 91 | .get('/redfish/v1/AccountService/Roles') |
| 92 | .then(({ data: { Members = [] } = {} }) => { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 93 | const roles = Members.map((role) => { |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 94 | return role['@odata.id'].split('/').pop(); |
| 95 | }); |
| 96 | commit('setAccountRoles', roles); |
| 97 | }) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 98 | .catch((error) => console.log(error)); |
Yoshie Muranaka | 038a9da | 2020-04-17 11:22:56 -0700 | [diff] [blame] | 99 | }, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 100 | async createUser({ dispatch }, { username, password, privilege, status }) { |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 101 | const data = { |
| 102 | UserName: username, |
| 103 | Password: password, |
| 104 | RoleId: privilege, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 105 | Enabled: status, |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 106 | }; |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 107 | return await api |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 108 | .post('/redfish/v1/AccountService/Accounts', data) |
| 109 | .then(() => dispatch('getUsers')) |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 110 | .then(() => |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 111 | i18n.t('pageUserManagement.toast.successCreateUser', { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 112 | username, |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 113 | }) |
| 114 | ) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 115 | .catch((error) => { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 116 | console.log(error); |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 117 | const message = i18n.t('pageUserManagement.toast.errorCreateUser', { |
| 118 | username, |
| 119 | }); |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 120 | throw new Error(message); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 121 | }); |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 122 | }, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 123 | async updateUser( |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 124 | { dispatch }, |
Yoshie Muranaka | 1f9ed4c | 2020-03-26 16:59:54 -0700 | [diff] [blame] | 125 | { originalUsername, username, password, privilege, status, locked } |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 126 | ) { |
| 127 | const data = {}; |
| 128 | if (username) data.UserName = username; |
| 129 | if (password) data.Password = password; |
| 130 | if (privilege) data.RoleId = privilege; |
| 131 | if (status !== undefined) data.Enabled = status; |
Yoshie Muranaka | 1f9ed4c | 2020-03-26 16:59:54 -0700 | [diff] [blame] | 132 | if (locked !== undefined) data.Locked = locked; |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 133 | return await api |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 134 | .patch(`/redfish/v1/AccountService/Accounts/${originalUsername}`, data) |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 135 | .then(() => dispatch('getUsers')) |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 136 | .then(() => |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 137 | i18n.t('pageUserManagement.toast.successUpdateUser', { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 138 | username: originalUsername, |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 139 | }) |
| 140 | ) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 141 | .catch((error) => { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 142 | console.log(error); |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 143 | const message = i18n.t('pageUserManagement.toast.errorUpdateUser', { |
| 144 | username: originalUsername, |
| 145 | }); |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 146 | throw new Error(message); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 147 | }); |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 148 | }, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 149 | async deleteUser({ dispatch }, username) { |
| 150 | return await api |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 151 | .delete(`/redfish/v1/AccountService/Accounts/${username}`) |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 152 | .then(() => dispatch('getUsers')) |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 153 | .then(() => |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 154 | i18n.t('pageUserManagement.toast.successDeleteUser', { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 155 | username, |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 156 | }) |
| 157 | ) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 158 | .catch((error) => { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 159 | console.log(error); |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 160 | const message = i18n.t('pageUserManagement.toast.errorDeleteUser', { |
| 161 | username, |
| 162 | }); |
Yoshie Muranaka | 8fc53ad | 2020-05-04 10:40:41 -0700 | [diff] [blame] | 163 | throw new Error(message); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 164 | }); |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 165 | }, |
| 166 | async deleteUsers({ dispatch }, users) { |
| 167 | const promises = users.map(({ username }) => { |
| 168 | return api |
| 169 | .delete(`/redfish/v1/AccountService/Accounts/${username}`) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 170 | .catch((error) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 171 | console.log(error); |
| 172 | return error; |
| 173 | }); |
| 174 | }); |
| 175 | return await api |
| 176 | .all(promises) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 177 | .then((response) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 178 | dispatch('getUsers'); |
| 179 | return response; |
| 180 | }) |
| 181 | .then( |
| 182 | api.spread((...responses) => { |
| 183 | const { successCount, errorCount } = getResponseCount(responses); |
| 184 | let toastMessages = []; |
| 185 | |
| 186 | if (successCount) { |
| 187 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 188 | 'pageUserManagement.toast.successBatchDelete', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 189 | successCount |
| 190 | ); |
| 191 | toastMessages.push({ type: 'success', message }); |
| 192 | } |
| 193 | |
| 194 | if (errorCount) { |
| 195 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 196 | 'pageUserManagement.toast.errorBatchDelete', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 197 | errorCount |
| 198 | ); |
| 199 | toastMessages.push({ type: 'error', message }); |
| 200 | } |
| 201 | |
| 202 | return toastMessages; |
| 203 | }) |
| 204 | ); |
| 205 | }, |
| 206 | async enableUsers({ dispatch }, users) { |
| 207 | const data = { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 208 | Enabled: true, |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 209 | }; |
| 210 | const promises = users.map(({ username }) => { |
| 211 | return api |
| 212 | .patch(`/redfish/v1/AccountService/Accounts/${username}`, data) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 213 | .catch((error) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 214 | console.log(error); |
| 215 | return error; |
| 216 | }); |
| 217 | }); |
| 218 | return await api |
| 219 | .all(promises) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 220 | .then((response) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 221 | dispatch('getUsers'); |
| 222 | return response; |
| 223 | }) |
| 224 | .then( |
| 225 | api.spread((...responses) => { |
| 226 | const { successCount, errorCount } = getResponseCount(responses); |
| 227 | let toastMessages = []; |
| 228 | |
| 229 | if (successCount) { |
| 230 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 231 | 'pageUserManagement.toast.successBatchEnable', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 232 | successCount |
| 233 | ); |
| 234 | toastMessages.push({ type: 'success', message }); |
| 235 | } |
| 236 | |
| 237 | if (errorCount) { |
| 238 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 239 | 'pageUserManagement.toast.errorBatchEnable', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 240 | errorCount |
| 241 | ); |
| 242 | toastMessages.push({ type: 'error', message }); |
| 243 | } |
| 244 | |
| 245 | return toastMessages; |
| 246 | }) |
| 247 | ); |
| 248 | }, |
| 249 | async disableUsers({ dispatch }, users) { |
| 250 | const data = { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 251 | Enabled: false, |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 252 | }; |
| 253 | const promises = users.map(({ username }) => { |
| 254 | return api |
| 255 | .patch(`/redfish/v1/AccountService/Accounts/${username}`, data) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 256 | .catch((error) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 257 | console.log(error); |
| 258 | return error; |
| 259 | }); |
| 260 | }); |
| 261 | return await api |
| 262 | .all(promises) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 263 | .then((response) => { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 264 | dispatch('getUsers'); |
| 265 | return response; |
| 266 | }) |
| 267 | .then( |
| 268 | api.spread((...responses) => { |
| 269 | const { successCount, errorCount } = getResponseCount(responses); |
| 270 | let toastMessages = []; |
| 271 | |
| 272 | if (successCount) { |
| 273 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 274 | 'pageUserManagement.toast.successBatchDisable', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 275 | successCount |
| 276 | ); |
| 277 | toastMessages.push({ type: 'success', message }); |
| 278 | } |
| 279 | |
| 280 | if (errorCount) { |
| 281 | const message = i18n.tc( |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 282 | 'pageUserManagement.toast.errorBatchDisable', |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 283 | errorCount |
| 284 | ); |
| 285 | toastMessages.push({ type: 'error', message }); |
| 286 | } |
| 287 | |
| 288 | return toastMessages; |
| 289 | }) |
| 290 | ); |
Yoshie Muranaka | 1b1c100 | 2020-02-20 10:18:36 -0800 | [diff] [blame] | 291 | }, |
| 292 | async saveAccountSettings( |
| 293 | { dispatch }, |
| 294 | { lockoutThreshold, lockoutDuration } |
| 295 | ) { |
| 296 | const data = {}; |
| 297 | if (lockoutThreshold !== undefined) { |
| 298 | data.AccountLockoutThreshold = lockoutThreshold; |
| 299 | } |
| 300 | if (lockoutDuration !== undefined) { |
| 301 | data.AccountLockoutDuration = lockoutDuration; |
| 302 | } |
| 303 | |
| 304 | return await api |
| 305 | .patch('/redfish/v1/AccountService', data) |
| 306 | //GET new settings to update view |
| 307 | .then(() => dispatch('getAccountSettings')) |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 308 | .then(() => i18n.t('pageUserManagement.toast.successSaveSettings')) |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 309 | .catch((error) => { |
Yoshie Muranaka | 1b1c100 | 2020-02-20 10:18:36 -0800 | [diff] [blame] | 310 | console.log(error); |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 311 | const message = i18n.t('pageUserManagement.toast.errorSaveSettings'); |
Yoshie Muranaka | 1b1c100 | 2020-02-20 10:18:36 -0800 | [diff] [blame] | 312 | throw new Error(message); |
| 313 | }); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 314 | }, |
| 315 | }, |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 316 | }; |
| 317 | |
Sandeepa Singh | b440616 | 2021-07-26 15:05:39 +0530 | [diff] [blame] | 318 | export default UserManagementStore; |