fix: if the user leaves org, logout

This commit is contained in:
Arman committed 2022-09-06 15:47:27 +02:00
1 parent 7120021d52
commit bd01910816
1 file changed
+9 -1
@@ -1,4 +1,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { goto } from '$app/navigation';
import { Modal } from '$lib/components';
import { Button, Form } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
@@ -15,8 +17,14 @@
const deleteMembership = async () => {
try {
await sdkForConsole.teams.deleteMembership(selectedMember.teamId, selectedMember.$id);
if (isUser) {
user.logout();
await goto(`${base}/login`);
} else {
dispatch('deleted');
}
showDelete = false;
dispatch('deleted');
addNotification({
type: 'success',
message: `${selectedMember.userName} was deleted from ${selectedMember.teamName}`