Trim inputs in 'Form'

This commit is contained in:
Alexis Sellier
2021-06-23 14:48:19 +02:00
parent eff69338d5
commit dddaa2040e
4 changed files with 13 additions and 7 deletions
-1
View File
@@ -27,7 +27,6 @@
const dispatch = createEventDispatcher();
/* let state: State = { status: Status.Signing }; */
let state: State = { status: Status.Failed, error: "Error registering, something happened." };
onMount(async () => {
+3 -4
View File
@@ -67,14 +67,13 @@
});
});
const onSave = async (event: { detail: Field[] }) => {
const onSave = async (event: { detail: { name: string; value: string | null }[] }) => {
assert(state.status === Status.Found, "registration must be found");
updateRecords = event.detail
.filter(r => r.editable && r.value !== null)
.filter(f => f.value !== null)
.map(f => {
assert(f.value !== null);
return { name: f.name, value: f.value };
return { name: f.name, value: f.value as string };
});
};