Fix issue when using an invalid group ID in url
This commit is contained in:
parent
7cc728ca69
commit
24fdef92b4
|
@ -1,7 +1,7 @@
|
|||
<script>
|
||||
import { PickerDropdown, notifications } from "@budibase/bbui"
|
||||
import { PickerDropdown } from "@budibase/bbui"
|
||||
import { groups } from "stores/portal"
|
||||
import { onMount, createEventDispatcher } from "svelte"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
|
@ -25,14 +25,6 @@
|
|||
const appIds = groupSelected?.apps.map(x => x.appId) || null
|
||||
dispatch("change", appIds)
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
await groups.actions.init()
|
||||
} catch (error) {
|
||||
notifications.error("Error")
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<PickerDropdown
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
$users.data?.filter(x => !group?.users.map(y => y._id).includes(x._id)) ||
|
||||
[]
|
||||
$: groupApps = $apps.filter(x => group?.apps.includes(x.appId))
|
||||
$: {
|
||||
if (loaded && !group?._id) {
|
||||
$goto("./")
|
||||
}
|
||||
}
|
||||
|
||||
async function addAll() {
|
||||
selectedUsers = [...selectedUsers, ...filtered.map(u => u._id)]
|
||||
|
|
|
@ -73,9 +73,7 @@
|
|||
|
||||
onMount(async () => {
|
||||
try {
|
||||
if ($auth.groupsEnabled) {
|
||||
await groups.actions.init()
|
||||
}
|
||||
} catch (error) {
|
||||
notifications.error("Error getting user groups")
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { writable, get } from "svelte/store"
|
||||
import { API } from "api"
|
||||
import { auth } from "stores/portal"
|
||||
import { Constants } from "@budibase/frontend-core"
|
||||
|
||||
export function createGroupsStore() {
|
||||
const store = writable([])
|
||||
|
@ -10,9 +9,7 @@ export function createGroupsStore() {
|
|||
init: async () => {
|
||||
// only init if these is a groups license, just to be sure but the feature will be blocked
|
||||
// on the backend anyway
|
||||
if (
|
||||
get(auth).user.license.features.includes(Constants.Features.USER_GROUPS)
|
||||
) {
|
||||
if (get(auth).groupsEnabled) {
|
||||
const users = await API.getGroups()
|
||||
store.set(users)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue