async fetchGroups()

in src/lib/store/modules/group.store.js [32:51]


    async fetchGroups({commit}, {offset = 0, limit = 50, groupId = null, tenantId = null, clientId = null, username} = {}) {

        // await new Promise(resolve => setTimeout(resolve, 1000));

        // TODO enable api filtering, pagination, etc.
        let queryString = JSON.stringify({offset, limit, groupId, tenantId, clientId, username});

        let {data: {groups}} = await custosService.groups.getAllGroups({offset, limit, groupId, tenantId, clientId, username});
        const groupIds = groups.map((
            {id, name, description, owner_id, realm_roles, client_roles, attributes, sub_groups}
        ) => {
            const groupId = id
            commit('SET_GROUP', {
                groupId, name, description, ownerId: owner_id, realm_roles, client_roles, attributes, sub_groups
            });

            return groupId;
        });
        commit('SET_GROUP_LIST', {queryString, groupIds});
    },