diff --git a/src/lib/common.ts b/src/lib/common.ts index 680e35208..4eec73539 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -100,6 +100,7 @@ export const getUserDetails = async (event, isAdminRequired = true) => { message: 'OK' } }; + if (isAdminRequired && permission !== 'admin' && permission !== 'owner') { payload.status = 401; payload.body.message = diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 8d5922450..b6cb57435 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -12,7 +12,7 @@ if (!session.userId) { return {}; } - const endpoint = `/teams.json`; + const endpoint = `/dashboard.json`; const res = await fetch(endpoint); if (res.ok) { diff --git a/src/routes/applications/index.svelte b/src/routes/applications/index.svelte index 5f6056ac5..049bded43 100644 --- a/src/routes/applications/index.svelte +++ b/src/routes/applications/index.svelte @@ -8,6 +8,16 @@ const { id } = await post('/applications/new', {}); return await goto(`/applications/${id}`, { replaceState: true }); } + const ownApplications = applications.filter((application) => { + if (application.teams[0].id === $session.teamId) { + return application; + } + }); + const otherApplications = applications.filter((application) => { + if (application.teams[0].id !== $session.teamId) { + return application; + } + });