Implement tag management with SQLite; update save and retrieve endpoints
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
<label for="time">Tid (valfritt)</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="tags" placeholder="Taggar">
|
||||
<input type="text" id="tags" placeholder="Taggar" autocomplete="off">
|
||||
<label for="tags">Taggar</label>
|
||||
</div>
|
||||
<button class="btn waves-effect waves-light" type="submit">Spara uppgift</button>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
export function saveTags(tags) {
|
||||
export async function saveTags(newTags) {
|
||||
const existingTags = await loadTags();
|
||||
const allTags = Array.from(new Set([...existingTags, ...newTags]));
|
||||
|
||||
return fetch('/save-tags', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ tags })
|
||||
body: JSON.stringify({ tags: allTags })
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user