diff --git a/ui/components/accounts/AccountsList.vue b/ui/components/accounts/AccountsList.vue
index ba0054dc22..ad84c838e1 100644
--- a/ui/components/accounts/AccountsList.vue
+++ b/ui/components/accounts/AccountsList.vue
@@ -7,36 +7,31 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ui/helpers/utils.js b/ui/helpers/utils.js
new file mode 100644
index 0000000000..2fceea84e4
--- /dev/null
+++ b/ui/helpers/utils.js
@@ -0,0 +1,8 @@
+/**
+ * Asserts wheter the given object is empty
+ * @param {Object} obj Object to be checked
+ * @returns {Boolean}
+ */
+export function isObjectEmpty (obj) {
+ return Object.keys(obj).length === 0 && obj.constructor === Object
+}
diff --git a/ui/store/index.js b/ui/store/index.js
index db81d2d40f..a83a66bdba 100644
--- a/ui/store/index.js
+++ b/ui/store/index.js
@@ -7,7 +7,8 @@ import axios from 'axios'
const state = {
config: null,
initialized: false,
- accounts: {}
+ accounts: {},
+ roles: null
}
const getters = {
@@ -32,6 +33,9 @@ const mutations = {
},
SET_ACCOUNTS (state, accounts) {
state.accounts = accounts
+ },
+ SET_ROLES (state, roles) {
+ state.roles = roles
}
}
@@ -42,6 +46,7 @@ const actions = {
async initialize ({ commit, dispatch }) {
await dispatch('fetchAccounts')
+ await dispatch('fetchRoles')
commit('SET_INITIALIZED', true)
},
@@ -61,6 +66,24 @@ const actions = {
status: 'danger'
}, { root: true })
}
+ },
+
+ async fetchRoles ({ commit, rootGetters }) {
+ const headers = new Headers()
+
+ headers.append('Authorization', 'Bearer ' + rootGetters.getToken)
+
+ let roles = await fetch(`${rootGetters.configuration.server}/api/v0/settings/roles-list`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: this.headers,
+ body: JSON.stringify({
+ account_uuid: rootGetters.user.id
+ })
+ })
+
+ roles = await roles.json()
+ commit('SET_ROLES', roles.bundles)
}
}