diff options
Diffstat (limited to 'src/store/modules/AccessControl/LocalUserMangementStore.js')
-rw-r--r-- | src/store/modules/AccessControl/LocalUserMangementStore.js | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js index dddfd2cc..41bbe0d8 100644 --- a/src/store/modules/AccessControl/LocalUserMangementStore.js +++ b/src/store/modules/AccessControl/LocalUserMangementStore.js @@ -1,4 +1,4 @@ -import Axios from "axios"; +import api from "../../api"; const LocalUserManagementStore = { namespaced: true, @@ -17,38 +17,21 @@ const LocalUserManagementStore = { }, actions: { getUsers({ commit }) { - let base; - let username; - let password; - if (base && username && password) { - Axios.defaults.baseURL = base; - Axios.defaults.auth = {}; - Axios.defaults.auth.username = username; - Axios.defaults.auth.password = password; - Axios.get("redfish/v1/AccountService/Accounts") - .then(response => { - return response.data.Members.map(user => user["@odata.id"]); - }) - .then(userIds => { - return Axios.all(userIds.map(user => Axios.get(user))); - }) - .then(users => { - const userData = users.map(user => user.data); - commit("setUsers", userData); - }) - .catch(error => { - console.log(error); - }); - } else { - // Faking async call with timeout - setTimeout(() => { - const users = [ - { UserName: "root", RoleId: "Admin", Locked: false, Enabled: true }, - { UserName: "user1", RoleId: "user", Locked: false, Enabled: false } - ]; - commit("setUsers", users); - }, 3000); - } + api + .get("/redfish/v1/AccountService/Accounts") + .then(response => { + return response.data.Members.map(user => user["@odata.id"]); + }) + .then(userIds => { + return api.all(userIds.map(user => api.get(user))); + }) + .then(users => { + const userData = users.map(user => user.data); + commit("setUsers", userData); + }) + .catch(error => { + console.log(error); + }); } } }; |