Skip to content

Commit

Permalink
NoAccess page for Annuncements and Workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunga-Ntando-Ndlovu committed Sep 30, 2024
1 parent e8bdfc4 commit 85916e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/src/routes/(app)/announcements/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<script>
import Announcements from '$src/lib/components/announcements/Main.svelte';
import NoAccess from '$src/lib/components/common/PageUnavailable.svelte';
export let data;
</script>

<Announcements {data} view={'admin'} />
<!-- On the assumption each user has an organisation (besides admin) -->
{#if data.organisation === undefined}
<NoAccess />
{:else}
<Announcements {data} view={'admin'} />
{/if}
6 changes: 4 additions & 2 deletions src/src/routes/(app)/workspaces/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ export async function load({ locals }) {
getWorkspaces(locals.user.organisation),
getLecturers(locals.user.organisation)
]);

const organisation = locals.user.organisation.toString() || null;
let organisation;
if (locals.user.organisation !== undefined) {
organisation = locals.user.organisation.toString() || null;
}

return { role: locals.user.role, lecturers, workspaces, organisation };
} else {
Expand Down
3 changes: 1 addition & 2 deletions src/src/routes/(app)/workspaces/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import NoAccess from '$src/lib/components/common/PageUnavailable.svelte';
export let data: any;
$: ({ organisation } = data);
</script>

{#if data.role === 'admin'}
{#if organisation === undefined}
{#if data.organisation === undefined}
<NoAccess />
{:else}
<AdminWorkspaces {data} />
Expand Down

0 comments on commit 85916e1

Please sign in to comment.