Skip to content

Commit

Permalink
Usablilty improvements + error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ra4nd0m committed Aug 24, 2023
1 parent 2383120 commit 93f7e4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/pages/components/AddRecord.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
console.log(material_props_list);
});
async function submitRecord() {
let sentSomething: boolean = false;
for (const prop of material_props_list) {
let payload = {
material_source_id: mat_id,
property_name: prop.Name,
value_float: prop.Value,
value_str: prop.Value,
created_on: created_on,
};
console.log(payload);
await doFetch(JSON.stringify(payload), "/addValue", secret);
if (typeof prop.Value != "undefined") {
sentSomething = true;
let payload = {
material_source_id: mat_id,
property_name: prop.Name,
value_float: prop.Value,
value_str: prop.Value,
created_on: created_on,
};
await doFetch(JSON.stringify(payload), "/addValue", secret);
}
}
if (!sentSomething) alert("Поля пусты!\nЗаполните хотя бы одно!");
}
interface propVal extends matProp {
Value?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/components/SubmenuSwitch.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
export let selectedMenu;
export let selectedMenu = "propsList";
</script>

<div>
Expand Down

0 comments on commit 93f7e4f

Please sign in to comment.