fix(dashboard): fix editing visibility privacy not changing header
This commit is contained in:
		@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -151,7 +151,7 @@
 | 
			
		||||
                    Edit privacy
 | 
			
		||||
                </ModalHeader>
 | 
			
		||||
                    <ModalBody>
 | 
			
		||||
                        <Privacy bind:member bind:privacyOpen/>
 | 
			
		||||
                        <Privacy on:update bind:member bind:privacyOpen/>
 | 
			
		||||
                    </ModalBody>
 | 
			
		||||
            </Modal>
 | 
			
		||||
        </Col>
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user