preparing to update item base data

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-10-15 16:11:33 +02:00
parent 2364140cfa
commit 3c733a75ee
5 changed files with 117 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
<script>
import LineEditor from '../../Components/LineEditor.svelte';
import { onMount } from 'svelte';
import { api } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
@@ -40,10 +41,25 @@
yikes();
} else error(res);
}
async function updateTitle(newVal){
const url = api('stock');
const data = {
id : item.id,
owner : item.owner,
title : newVal
}
const res = await fetch(url,{
credentials:'include',
method:'PATCH',
body:JSON.stringify(data)
});
return false;
}
</script>
{#if item}
<h3>{item.name}</h3>
<LineEditor type="h3" editable={true} value={item.name} onSet={updateTitle}/>
<table>
<tbody>