feat(dashboard): dont close out of editor after submitting
This commit is contained in:
parent
13eaad59db
commit
dd60f646b0
@ -8,6 +8,8 @@
|
||||
const descriptions: string[] = JSON.parse(localStorage.getItem("pk-config"))?.description_templates;
|
||||
|
||||
let loading: boolean = false;
|
||||
let success = false;
|
||||
|
||||
export let group: Group;
|
||||
export let editMode: boolean;
|
||||
|
||||
@ -24,6 +26,7 @@
|
||||
async function submit() {
|
||||
let data = input;
|
||||
err = [];
|
||||
success = false;
|
||||
|
||||
if (data.color && !/^#?[A-Fa-f0-9]{6}$/.test(input.color)) {
|
||||
err.push(`"${data.color}" is not a valid color, the color must be a 6-digit hex code. (example: #ff0000)`);
|
||||
@ -41,7 +44,7 @@
|
||||
let res = await api().groups(group.id).patch({data});
|
||||
group = {...group, ...res};
|
||||
err = [];
|
||||
editMode = false;
|
||||
success = true;
|
||||
loading = false;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
@ -90,8 +93,11 @@
|
||||
</script>
|
||||
|
||||
{#each err as error}
|
||||
<Alert color="danger">{@html error}</Alert>
|
||||
<Alert fade={false} color="danger">{@html error}</Alert>
|
||||
{/each}
|
||||
{#if success}
|
||||
<Alert fade={false} color="success">Group information updated!</Alert>
|
||||
{/if}
|
||||
<Row>
|
||||
<Col xs={12} lg={4} class="mb-2">
|
||||
<Label>Name:</Label>
|
||||
|
@ -14,6 +14,7 @@
|
||||
export let editMode: boolean;
|
||||
|
||||
let err: string[] = [];
|
||||
let success = false;
|
||||
|
||||
let input: Member = member;
|
||||
|
||||
@ -66,15 +67,13 @@
|
||||
try {
|
||||
let res = await api().members(member.id).patch({data});
|
||||
member = res;
|
||||
err = [];
|
||||
editMode = false;
|
||||
loading = false;
|
||||
success = true;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
err.push(error.message);
|
||||
err = err;
|
||||
loading = false;
|
||||
}
|
||||
loading = false;
|
||||
}
|
||||
|
||||
let deleteOpen: boolean = false;
|
||||
@ -116,8 +115,11 @@
|
||||
</script>
|
||||
|
||||
{#each err as error}
|
||||
<Alert color="danger">{@html error}</Alert>
|
||||
<Alert fade={false} color="danger">{@html error}</Alert>
|
||||
{/each}
|
||||
{#if success}
|
||||
<Alert fade={false} color="success">Member information updated!</Alert>
|
||||
{/if}
|
||||
<Row>
|
||||
<Col xs={12} lg={4} class="mb-2">
|
||||
<Label>Name:</Label>
|
||||
|
Loading…
Reference in New Issue
Block a user