From ff2c38aa16344e3ffb7f7a0f2def56316b71cc45 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 12 Apr 2022 16:49:59 +0200 Subject: [PATCH] fix: Invitations --- src/routes/iam/index.svelte | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/routes/iam/index.svelte b/src/routes/iam/index.svelte index 8c33d5a38..1ebfaac60 100644 --- a/src/routes/iam/index.svelte +++ b/src/routes/iam/index.svelte @@ -32,6 +32,7 @@ export let account; export let accounts; + export let invitations; if (accounts.length === 0) { accounts.push(account); } @@ -74,12 +75,51 @@ return errorNotification(error); } } + async function acceptInvitation(id, teamId) { + try { + await post(`/iam/team/${teamId}/invitation/accept.json`, { id }); + return window.location.reload(); + } catch ({ error }) { + return errorNotification(error); + } + } + async function revokeInvitation(id, teamId) { + try { + await post(`/iam/team/${teamId}/invitation/revoke.json`, { id }); + return window.location.reload(); + } catch ({ error }) { + return errorNotification(error); + } + }
Identity and Access Management
+{#if invitations.length > 0} +
+
Pending invitations
+
+ {#each invitations as invitation} +
+
+ Invited to {invitation.teamName} with + {invitation.permission} permission. +
+ + +
+ {/each} +
+
+{/if}
{#if $session.teamId === '0' && accounts.length > 0}
Accounts