preparing to update item base data
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user