diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-09-20 10:23:51 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-09-20 10:23:51 +0200 |
| commit | 9a09b5d7448b32af7bc9f7972d1ef61c631ef436 (patch) | |
| tree | b7f4f44fc98331fd141e7320ae4839f69dc36e7f /apps/kit/src/routes/(public) | |
| parent | a9072370ca1eb9a5cce928b1d487db0f307edea6 (diff) | |
| download | greatoffice-9a09b5d7448b32af7bc9f7972d1ef61c631ef436.tar.xz greatoffice-9a09b5d7448b32af7bc9f7972d1ef61c631ef436.zip | |
feat: Loading locales now work, needs a bit of a polish
Diffstat (limited to 'apps/kit/src/routes/(public)')
| -rw-r--r-- | apps/kit/src/routes/(public)/+layout.svelte | 3 | ||||
| -rw-r--r-- | apps/kit/src/routes/(public)/login/+page.svelte | 11 |
2 files changed, 7 insertions, 7 deletions
diff --git a/apps/kit/src/routes/(public)/+layout.svelte b/apps/kit/src/routes/(public)/+layout.svelte index 1301e50..84cd442 100644 --- a/apps/kit/src/routes/(public)/+layout.svelte +++ b/apps/kit/src/routes/(public)/+layout.svelte @@ -1,6 +1,3 @@ <script> - import {setLocale} from "$lib/i18n/i18n-svelte"; - - setLocale("nb"); </script> <slot></slot>
\ No newline at end of file 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()}</a> </p> </div> - + <button on:click={async () => {await loadLocaleAsync("nb"); setLocale("nb")}}>Norge</button> <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md"> <div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10"> {#if error.text || error.title} |
