From 9a09b5d7448b32af7bc9f7972d1ef61c631ef436 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 20 Sep 2022 16:23:51 +0800 Subject: feat: Loading locales now work, needs a bit of a polish --- apps/kit/src/routes/(public)/login/+page.svelte | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apps/kit/src/routes/(public)/login') diff --git a/apps/kit/src/routes/(public)/login/+page.svelte b/apps/kit/src/routes/(public)/login/+page.svelte index 800575e..36230e3 100644 --- a/apps/kit/src/routes/(public)/login/+page.svelte +++ b/apps/kit/src/routes/(public)/login/+page.svelte @@ -2,23 +2,26 @@ import {goto} from "$app/navigation"; import {login} from "$lib/api/user"; import LL from "$lib/i18n/i18n-svelte"; + import {setLocale} from "$lib/i18n/i18n-svelte"; + import {loadLocaleAsync} from "$lib/i18n/i18n-util.async"; import type {ErrorResult} from "$lib/models/ErrorResult"; import type {LoginPayload} from "$lib/models/LoginPayload"; const data = { username: "", - password: "" + password: "", } as LoginPayload; + let error = { text: "", - title: "" + title: "", } as ErrorResult; async function submitFormAsync() { error = {text: "", title: ""}; const loginResponse = await login(data); if (loginResponse.ok) { - await goto("/home") + await goto("/home"); } else { error.title = loginResponse.data.title; error.text = loginResponse.data.text; @@ -34,7 +37,7 @@ class="font-medium text-indigo-600 hover:text-indigo-500">{$LL.login.createANewAccount()}

- +
{#if error.text || error.title} -- cgit v1.3