This commit is contained in:
Ewen 2023-09-15 17:15:56 +02:00
parent b5ce0124a0
commit 3601fc81e8
2 changed files with 17 additions and 10 deletions

View file

@ -38,14 +38,20 @@
function updateWord() {
try {
axios.patch("words/" + id + "/", { word: word });
axios.patch("words/" + id + "/", { word: word }).then(() => {
isEditWord = false;
});
} catch (e) {
console.log(e);
}
}
function updateDefinition() {
try {
axios.patch("words/" + id + "/", { definition: definition });
axios
.patch("words/" + id + "/", { definition: definition })
.then(() => {
isEditDefinition = false;
});
} catch (e) {
console.log(e);
}

View file

@ -137,17 +137,20 @@
on:change={handleChange}
bind:value={$form.level}
class="p-1 rounded-md border"
required
>
{#await promiseLevels}<option></option>
{:then}
{#each levels as level}
<option value={level.levelNumber}
>{level.levelString}</option
{#await promiseLevels then}
{#each levels as level, i}
<option value={level.levelNumber}>
{level.levelString}</option
>
{/each}
{/await}
</select>
{#if $errors.level}
<div class="text-red-500 text-sm">
{$errors.level}
</div>
{/if}
</td>
<td class="p-2">
<input
@ -156,7 +159,6 @@
on:change={handleChange}
bind:value={$form.word}
class="p-1 rounded-md border w-full"
required
/>
</td>
<td class="p-2">
@ -166,7 +168,6 @@
on:change={handleChange}
bind:value={$form.definition}
class="p-1 rounded-md border w-full"
required
/>
</td>
<td class="p-2">