mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-12-23 00:13:45 +00:00
Add autocomplete to edit
This commit is contained in:
parent
16c9f998d5
commit
2cc9705845
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { getPost, postUpdate } from "../api.js";
|
||||
import { getPost, postUpdate, getTagAutocomplete } from "../api.js";
|
||||
import { navigate } from "svelte-routing";
|
||||
import Tags from "svelte-tags-input";
|
||||
import { onMount } from "svelte";
|
||||
@ -26,6 +26,11 @@
|
||||
form.tags = value.detail.tags;
|
||||
};
|
||||
|
||||
const onAutocomplete = async () => {
|
||||
const list = await getTagAutocomplete();
|
||||
return list;
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
const response = await postUpdate(id, form);
|
||||
navigate(`/post/${response.id}`);
|
||||
@ -71,6 +76,7 @@
|
||||
tags={form.tags}
|
||||
addKeys={[9, 32]}
|
||||
on:tags={onTagChange}
|
||||
autoComplete={onAutocomplete}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user