Browse Source

switch to using roles endpoint to get apps for roles page

gh-pages
Keviin Åberg Kultalahti 5 years ago
parent
commit
50a7138486
  1. 11
      packages/builder/src/pages/builder/portal/manage/users/[userId].svelte

11
packages/builder/src/pages/builder/portal/manage/users/[userId].svelte

@ -15,7 +15,7 @@
notifications, notifications,
} from "@budibase/bbui" } from "@budibase/bbui"
import { fetchData } from "helpers" import { fetchData } from "helpers"
import { users, apps } from "stores/portal" import { users } from "stores/portal"
import UpdateRolesModal from "./_components/UpdateRolesModal.svelte" import UpdateRolesModal from "./_components/UpdateRolesModal.svelte"
@ -28,14 +28,15 @@
role: { type: "options" }, role: { type: "options" },
} }
// Here we need to merge the Apps list and the roles response to get something that makes sense for the table // Merge the Apps list and the roles response to get something that makes sense for the table
$: appList = $apps.map(app => ({ $: appList = Object.keys($apps?.data).map(app => ({
...app, name: $apps?.data?.[app]?.name,
role: $roleFetch?.data?.roles?.[app._id], role: $roleFetch?.data?.roles?.[app],
})) }))
let selectedApp let selectedApp
const roleFetch = fetchData(`/api/admin/users/${userId}`) const roleFetch = fetchData(`/api/admin/users/${userId}`)
const apps = fetchData(`/api/admin/roles`)
async function deleteUser() { async function deleteUser() {
const res = await users.del(userId) const res = await users.del(userId)

Loading…
Cancel
Save