switch to using roles endpoint to get apps for roles page

This commit is contained in:
Keviin Åberg Kultalahti 2021-05-17 16:11:08 +02:00
parent 7082a1aaa2
commit b0265efb29
1 changed files with 6 additions and 5 deletions

View File

@ -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)