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() { function updateWord() {
try { try {
axios.patch("words/" + id + "/", { word: word }); axios.patch("words/" + id + "/", { word: word }).then(() => {
isEditWord = false;
});
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
} }
function updateDefinition() { function updateDefinition() {
try { try {
axios.patch("words/" + id + "/", { definition: definition }); axios
.patch("words/" + id + "/", { definition: definition })
.then(() => {
isEditDefinition = false;
});
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }

View file

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