Fix reactivity bug with normal user app list
This commit is contained in:
parent
b370b89a07
commit
4c26abc83d
|
@ -28,25 +28,13 @@
|
||||||
let userInfoModal
|
let userInfoModal
|
||||||
let changePasswordModal
|
let changePasswordModal
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
try {
|
|
||||||
await organisation.init()
|
|
||||||
await apps.load()
|
|
||||||
await groups.actions.init()
|
|
||||||
} catch (error) {
|
|
||||||
notifications.error("Error loading apps")
|
|
||||||
}
|
|
||||||
loaded = true
|
|
||||||
})
|
|
||||||
const publishedAppsOnly = app => app.status === AppStatus.DEPLOYED
|
|
||||||
|
|
||||||
$: userGroups = $groups.filter(group =>
|
$: userGroups = $groups.filter(group =>
|
||||||
group.users.find(user => user._id === $auth.user?._id)
|
group.users.find(user => user._id === $auth.user?._id)
|
||||||
)
|
)
|
||||||
$: publishedApps = $apps.filter(publishedAppsOnly)
|
$: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED)
|
||||||
$: userApps = getUserApps($auth.user)
|
$: userApps = getUserApps(publishedApps, userGroups, $auth.user)
|
||||||
|
|
||||||
function getUserApps(user) {
|
function getUserApps(publishedApps, userGroups, user) {
|
||||||
if (sdk.users.isAdmin(user)) {
|
if (sdk.users.isAdmin(user)) {
|
||||||
return publishedApps
|
return publishedApps
|
||||||
}
|
}
|
||||||
|
@ -84,6 +72,17 @@
|
||||||
// Swallow error and do nothing
|
// Swallow error and do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
await organisation.init()
|
||||||
|
await apps.load()
|
||||||
|
await groups.actions.init()
|
||||||
|
} catch (error) {
|
||||||
|
notifications.error("Error loading apps")
|
||||||
|
}
|
||||||
|
loaded = true
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $auth.user && loaded}
|
{#if $auth.user && loaded}
|
||||||
|
|
Loading…
Reference in New Issue