refactored more error code

This commit is contained in:
2025-09-26 21:10:19 +02:00
parent e3b735bb7b
commit 2463f92b1c
23 changed files with 111 additions and 173 deletions

View File

@@ -5,7 +5,6 @@
let { editPassword = $bindable() } = $props();
let caption = $state(t('update'));
let error = $state("");
let newPass = $state("");
let mismatch = $derived(newPass != repeat);
let newEmpty = $derived(!/\S/.test(newPass));
@@ -67,7 +66,4 @@
</label>
<button onclick={submit} disabled={sent||oldEmpty||newEmpty||mismatch}>{caption}</button>
<button onclick={abort} disabled={sent}>{t('abort')}</button>
{#if error}
<span class="error">{error}</span>
{/if}
</fieldset>

View File

@@ -3,10 +3,10 @@
import { useTinyRouter } from 'svelte-tiny-router';
import { api } from '../../urls.svelte.js';
import { error } from '../../warn.svelte';
import { t } from '../../translations.svelte.js';
let caption = t('send_mail');
let error = null;
let mail = "";
const router = useTinyRouter();
@@ -35,7 +35,7 @@
if (resp.ok){
router.navigate('/user')
} else {
error = await resp.text();
error(resp);
}
}
}
@@ -66,8 +66,5 @@
{t('enter_email')}
</label>
<button type="submit">{caption}</button>
{#if error}
<div class="error">{error}</div>
{/if}
</fieldset>
</form>