diff --git a/dashboard/src/lib/group/Body.svelte b/dashboard/src/lib/group/Body.svelte
index dd7368bf..2d729392 100644
--- a/dashboard/src/lib/group/Body.svelte
+++ b/dashboard/src/lib/group/Body.svelte
@@ -143,9 +143,9 @@
{:else if editMode}
-
+
{:else if memberMode}
-
+
{/if}
diff --git a/dashboard/src/lib/group/Edit.svelte b/dashboard/src/lib/group/Edit.svelte
index 01cf4482..e87badb8 100644
--- a/dashboard/src/lib/group/Edit.svelte
+++ b/dashboard/src/lib/group/Edit.svelte
@@ -23,6 +23,10 @@
dispatch('deletion', group.id);
}
+ function update(group: Group) {
+ dispatch('update', group);
+ }
+
async function submit() {
let data = input;
err = [];
@@ -45,7 +49,7 @@
loading = true;
try {
let res = await api().groups(group.id).patch({data});
- group = {...group, ...res};
+ update({...group, ...res});
err = [];
success = true;
loading = false;
diff --git a/dashboard/src/lib/list/CardsList.svelte b/dashboard/src/lib/list/CardsList.svelte
index b0d3dab2..b1d2137c 100644
--- a/dashboard/src/lib/list/CardsList.svelte
+++ b/dashboard/src/lib/list/CardsList.svelte
@@ -129,9 +129,9 @@
{#if itemType === "member"}
-
+
{:else if itemType === "group"}
-
+
{/if}
@@ -161,9 +161,9 @@
{#if itemType === "member"}
-
+
{:else if itemType === "group"}
-
+
{/if}
diff --git a/dashboard/src/lib/list/List.svelte b/dashboard/src/lib/list/List.svelte
index 088a8c77..9319b2c9 100644
--- a/dashboard/src/lib/list/List.svelte
+++ b/dashboard/src/lib/list/List.svelte
@@ -96,12 +96,20 @@
function updateDelete(event: any) {
if (itemType === "member") {
members = members.filter(m => m.id !== event.detail);
- list = members;
} else if (itemType === "group") {
groups = groups.filter(g => g.id !== event.detail);
- list = groups;
}
}
+
+ function update(event: any) {
+ console.log(event.detail);
+ if (itemType === "member") {
+ members = members.map(m => m.id === event.detail.id ? m = event.detail : m);
+ } else if (itemType === "group") {
+ groups = groups.map(g => g.id === event.detail.id ? g = event.detail : g);
+ }
+ }
+
@@ -131,6 +139,6 @@
{/if}
{/if}
-
+
{/if}
diff --git a/dashboard/src/lib/member/Body.svelte b/dashboard/src/lib/member/Body.svelte
index 568fa3fd..2c30d741 100644
--- a/dashboard/src/lib/member/Body.svelte
+++ b/dashboard/src/lib/member/Body.svelte
@@ -187,8 +187,8 @@
{/if}
{:else if editMode}
-
+
{:else if groupMode}
-
+
{/if}
diff --git a/dashboard/src/lib/member/Edit.svelte b/dashboard/src/lib/member/Edit.svelte
index 058fbc5c..1e5e77d0 100644
--- a/dashboard/src/lib/member/Edit.svelte
+++ b/dashboard/src/lib/member/Edit.svelte
@@ -16,7 +16,7 @@
let err: string[] = [];
let success = false;
- let input: Member = member;
+ let input: Member = JSON.parse(JSON.stringify(member));
const dispatch = createEventDispatcher();
@@ -24,6 +24,10 @@
dispatch('deletion', member.id);
}
+ function update(member: Member) {
+ dispatch('update', member);
+ }
+
async function submit() {
let data = input;
err = [];
@@ -69,7 +73,7 @@
loading = true;
try {
let res = await api().members(member.id).patch({data});
- member = res;
+ update({...member, ...res});
success = true;
} catch (error) {
console.log(error);