diff --git a/dashboard/src/lib/group/NewGroup.svelte b/dashboard/src/lib/group/NewGroup.svelte index 7a9134e7..1aedfa39 100644 --- a/dashboard/src/lib/group/NewGroup.svelte +++ b/dashboard/src/lib/group/NewGroup.svelte @@ -30,7 +30,7 @@ dispatch('create', input); } - let input: Group = defaultGroup; + let input: Group = JSON.parse(JSON.stringify(defaultGroup)); async function submit() { let data = input; @@ -51,7 +51,7 @@ loading = true; try { let res = await api().groups().post({data}); - input = res; + input = JSON.parse(JSON.stringify(defaultGroup)); err = []; create(); message = `Group ${data.name} successfully created!` diff --git a/dashboard/src/lib/member/NewMember.svelte b/dashboard/src/lib/member/NewMember.svelte index 64ec2dea..3514898d 100644 --- a/dashboard/src/lib/member/NewMember.svelte +++ b/dashboard/src/lib/member/NewMember.svelte @@ -33,7 +33,8 @@ ] }; - let input: Member = defaultMember; + // creating a deep copy here so that defaultMember doesn't get updated too + let input: Member = JSON.parse(JSON.stringify(defaultMember)); const dispatch = createEventDispatcher(); @@ -91,7 +92,7 @@ input = res; err = []; create(); - input = defaultMember; + input = JSON.parse(JSON.stringify(defaultMember));; message = `Member ${data.name} successfully created!` loading = false; } catch (error) {