From be543d6e3b0a3e6fdb07ecf2c75a7c25089a6ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Keviin=20=C3=85berg=20Kultalahti?= Date: Mon, 17 May 2021 13:23:19 +0200 Subject: [PATCH] fix not being able to update roles twice --- .../portal/manage/users/[userId].svelte | 18 +++++++++++------- .../users/_components/UpdateRolesModal.svelte | 14 +++++++++++--- 2 files changed, 22 insertions(+), 10 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 8af9467b76..f524a40b38 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/[userId].svelte @@ -31,16 +31,16 @@ // 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: $request?.data?.roles?.[app._id], + role: $roleFetch?.data?.roles?.[app._id], })) let selectedApp - const request = fetchData(`/api/admin/users/${userId}`) + const roleFetch = fetchData(`/api/admin/users/${userId}`) async function deleteUser() { const res = await users.del(userId) if (res.message) { - notifications.success(`User ${$request?.data?.email} deleted.`) + notifications.success(`User ${$roleFetch?.data?.email} deleted.`) $goto("./") } else { notifications.error("Failed to delete user.") @@ -61,7 +61,7 @@
- User: {$request?.data?.email} + User: {$roleFetch?.data?.email} Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis porro ut nesciunt ipsam perspiciatis aliquam et hic minus alias beatae. Odit @@ -76,7 +76,7 @@
- +
@@ -119,13 +119,17 @@ showCloseIcon={false} > Are you sure you want to delete {$request?.data?.email}Are you sure you want to delete {$roleFetch?.data?.email} - +