fix(dashboard): fix editing visibility privacy not changing header

This commit is contained in:
Jake Fulmine 2022-08-22 13:49:42 +02:00
parent 877b2cdf21
commit 34926660c8
4 changed files with 17 additions and 5 deletions

View File

@ -114,7 +114,7 @@
Edit privacy
</ModalHeader>
<ModalBody>
<Privacy bind:group bind:privacyOpen={privacyOpen}/>
<Privacy on:update bind:group bind:privacyOpen={privacyOpen}/>
</ModalBody>
</Modal>
</Col>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { tick } from "svelte";
import { tick, createEventDispatcher } from "svelte";
import { ModalBody, ModalHeader, Col, Row, Input, Label, ModalFooter, Button, Spinner, Alert } from "sveltestrap";
import { Group, GroupPrivacy } from '../../api/types';
@ -18,6 +18,12 @@
Object.keys(privacy).forEach(x => privacy[x] = target.value);
}
const dispatch = createEventDispatcher();
function update(group) {
dispatch('update', group);
}
// I can't use the hacked together Required<T> type from the bulk privacy here
// that breaks updating the displayed privacy after submitting
// but there's not really any way for any privacy fields here to be missing

View File

@ -151,7 +151,7 @@
Edit privacy
</ModalHeader>
<ModalBody>
<Privacy bind:member bind:privacyOpen/>
<Privacy on:update bind:member bind:privacyOpen/>
</ModalBody>
</Modal>
</Col>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { tick } from "svelte";
import { tick, createEventDispatcher } from "svelte";
import { Col, Row, Input, Label, Button, Alert, Spinner } from "sveltestrap";
import { Member, MemberPrivacy } from '../../api/types';
@ -18,6 +18,12 @@
Object.keys(privacy).forEach(x => privacy[x] = target.value);
}
const dispatch = createEventDispatcher();
function update(member) {
dispatch('update', member);
}
// I can't use the hacked together Required<T> type from the bulk privacy here
// that breaks updating the displayed privacy after submitting
// but there's not really any way for any privacy fields here to be missing
@ -38,7 +44,7 @@
const data: Member = {privacy: privacy};
try {
let res = await api().members(member.id).patch({data});
member = res;
update({...member, ...res});
success = true;
} catch (error) {
console.log(error);