From b0265efb29d8c3f5a51a2e59f7829accb84bd7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Mon, 17 May 2021 16:11:08 +0200 Subject: [PATCH] switch to using roles endpoint to get apps for roles page --- .../pages/builder/portal/manage/users/[userId].svelte | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte index f524a40b38..2d4b5d26c0 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte @@ -15,7 +15,7 @@ notifications, } from "@budibase/bbui" import { fetchData } from "helpers" - import { users, apps } from "stores/portal" + import { users } from "stores/portal" import UpdateRolesModal from "./_components/UpdateRolesModal.svelte" @@ -28,14 +28,15 @@ role: { type: "options" }, } - // Here we need to merge the Apps list and the roles response to get something that makes sense for the table - $: appList = $apps.map(app => ({ - ...app, - role: $roleFetch?.data?.roles?.[app._id], + // Merge the Apps list and the roles response to get something that makes sense for the table + $: appList = Object.keys($apps?.data).map(app => ({ + name: $apps?.data?.[app]?.name, + role: $roleFetch?.data?.roles?.[app], })) let selectedApp const roleFetch = fetchData(`/api/admin/users/${userId}`) + const apps = fetchData(`/api/admin/roles`) async function deleteUser() { const res = await users.del(userId)