From e00e274873f73bba50746ccfb58c44ccfd03240d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Wed, 13 Mar 2024 18:51:37 +0100 Subject: [PATCH] fix: populate possible f2 servers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I figured out how to handle Objects in Svelte each blocks and can therefore now pass the data through. Signed-off-by: André Jaenisch --- src/lib/components/organisms/LoginForm.svelte | 18 ++++++++++-------- src/lib/components/pages/Login.svelte | 9 ++++++++- src/lib/components/templates/Login.svelte | 19 +++++++++++-------- src/routes/account/login/+page.server.js | 11 +++++++++++ src/routes/account/login/+page.svelte | 5 ++++- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/lib/components/organisms/LoginForm.svelte b/src/lib/components/organisms/LoginForm.svelte index 96aa001..69c0a08 100644 --- a/src/lib/components/organisms/LoginForm.svelte +++ b/src/lib/components/organisms/LoginForm.svelte @@ -14,6 +14,13 @@ You should have received a copy of the GNU Affero General Public License along w - + diff --git a/src/lib/components/templates/Login.svelte b/src/lib/components/templates/Login.svelte index 83cba8b..a7be89b 100644 --- a/src/lib/components/templates/Login.svelte +++ b/src/lib/components/templates/Login.svelte @@ -16,10 +16,19 @@ You should have received a copy of the GNU Affero General Public License along w import LoginForm from '../organisms/LoginForm.svelte'; + /** + * PageData provided by SvelteKit. + */ + export let data: unknown = { + servers: {} + }; + /** * Form handling by SvelteKit */ - export let form: unknown = null; + export let form: unknown = { + servers: {} + }; /** * Translation keys to enable reuse @@ -49,18 +58,12 @@ You should have received a copy of the GNU Affero General Public License along w * Allow for linking stories in Storybook. */ export let sb = ''; - - const servers = { - '1': 'fig.fr33domlover.site', - '2': 'grape.fr33domlover.site', - '3': 'walnut.fr33domlover.site' - };

{$_('page.login.heading')}

{$_('page.login.intro')}

- +
diff --git a/src/routes/account/login/+page.server.js b/src/routes/account/login/+page.server.js index 84a3841..eb824a2 100644 --- a/src/routes/account/login/+page.server.js +++ b/src/routes/account/login/+page.server.js @@ -45,3 +45,14 @@ export const actions = { redirect(303, '/profile'); } }; + +/** @type {import('./$types').PageServerLoad} */ +export async function load({ params }) { + return { + servers: { + 1: 'fig.fr33domlover.site', + 2: 'grape.fr33domlover.site', + 3: 'walnut.fr33domlover.site' + } + }; +} diff --git a/src/routes/account/login/+page.svelte b/src/routes/account/login/+page.svelte index bbcd4a2..7980176 100644 --- a/src/routes/account/login/+page.svelte +++ b/src/routes/account/login/+page.svelte @@ -8,8 +8,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later - +