From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server-vie001.gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1741185670; bh=fWANQ62GX2OXpKD/4yQIlUZztyosBbmnbNTOm8dpn+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=a1r3RmKgMtykFbbk0plFJu/46V6BgSprGMIUjQ/FhZgqYWuSMqZIcrwNo3RUxXSSG s+3mPBUoM67pAquLQG5omOnvyWSO70QwxW+YWbjN9NrZuo3prFRw6ur3R6uxP9iOpC 02aTL+/30SjD0/Rt58xqC2KkK+TlmdVyI6olIjNhkI9QRfGwL77P86LJrCJ6lMv7kO s7rqItOR37JoLMHmb2GVsfl6Oh0KNF/gy6lfiF+HGbWVa4PAzLeG3Uuv9XIMSwDnYs IYjB4sl9kw3LhDHWt5snYb5pTXUmiRdQeoQK+oQtw95hLZUA0TM/vNqQbc54w2neWf NccQ9aHAQAU/g== Received: from localhost.localdomain (unknown [203.217.140.198]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id CD2BC20B4831; Wed, 5 Mar 2025 14:41:09 +0000 (UTC) From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 16/17] chore(login): use $derived() instead of function based Date: Wed, 5 Mar 2025 21:40:15 +0700 Message-ID: <20250305144018.267-17-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.46.0.windows.1 In-Reply-To: <20250305144018.267-1-kiizuha@gnuweeb.org> References: <20250305144018.267-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: this usage is the same as previous method. Signed-off-by: Muhammad Rizki --- src/routes/+page.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index f6820bc..b2c2874 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -45,14 +45,14 @@ } }); - const isError = () => Boolean($errors.username_or_email && $errors.password); - const isValid = () => Boolean($formData.username_or_email && $formData.password); - const isCredentialInvalid = () => Boolean(data.isInvalidCreds && +data.isInvalidCreds); - const { form: formData, errors, message, submitting, constraints, enhance } = form; + const isError = $derived(Boolean($errors.username_or_email && $errors.password)); + const isValid = $derived(Boolean($formData.username_or_email && $formData.password)); + const isCredentialInvalid = $derived(Boolean(data.isInvalidCreds && +data.isInvalidCreds)); + onMount(() => { - if (!isCredentialInvalid()) return; + if (!isCredentialInvalid) return; localStorage.removeItem("gwm_invalid_creds"); }); @@ -68,13 +68,13 @@ Proceed login to manage your email account - {#if isError() && !isCredentialInvalid()} + {#if isError && !isCredentialInvalid} {$message} {/if} - {#if !isError() && isCredentialInvalid()} + {#if !isError && isCredentialInvalid} Invalid credential, please login again. @@ -121,7 +121,7 @@