add working development access toggle
This commit is contained in:
parent
cdc7e604e5
commit
36b098bc73
|
@ -43,7 +43,7 @@
|
|||
const apps = fetchData(`/api/admin/roles`)
|
||||
|
||||
async function deleteUser() {
|
||||
const res = await users.del(userId)
|
||||
const res = await users.delete(userId)
|
||||
if (res.message) {
|
||||
notifications.success(`User ${$userFetch?.data?.email} deleted.`)
|
||||
$goto("./")
|
||||
|
@ -52,7 +52,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
async function toggleBuilderAccess() {}
|
||||
let toggleDisabled = false
|
||||
|
||||
async function toggleBuilderAccess({ detail }) {
|
||||
toggleDisabled = true
|
||||
await users.save({ ...$userFetch?.data, builder: { global: detail } })
|
||||
await userFetch.refresh()
|
||||
toggleDisabled = false
|
||||
}
|
||||
|
||||
async function openUpdateRolesModal({ detail }) {
|
||||
console.log(detail)
|
||||
|
@ -90,7 +97,12 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<Label size="L">Development access?</Label>
|
||||
<Toggle text="" value={$userFetch?.data?.builder?.global} />
|
||||
<Toggle
|
||||
text=""
|
||||
value={$userFetch?.data?.builder?.global}
|
||||
on:change={toggleBuilderAccess}
|
||||
disabled={toggleDisabled}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="regenerate">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
let selectedRole
|
||||
|
||||
async function updateUserRoles() {
|
||||
const res = await users.updateRoles({
|
||||
const res = await users.save({
|
||||
...user,
|
||||
roles: {
|
||||
...user.roles,
|
||||
|
|
Loading…
Reference in New Issue