fix render
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { createSignal, createEffect, Show, onMount } from "solid-js";
|
import { createSignal, Show, onMount } from "solid-js";
|
||||||
import { Title, Meta } from "@solidjs/meta";
|
import { Title, Meta } from "@solidjs/meta";
|
||||||
import { useNavigate, cache, redirect } from "@solidjs/router";
|
import { useNavigate, redirect, query } from "@solidjs/router";
|
||||||
import { getEvent } from "vinxi/http";
|
import { getEvent } from "vinxi/http";
|
||||||
import Eye from "~/components/icons/Eye";
|
import Eye from "~/components/icons/Eye";
|
||||||
import EyeSlash from "~/components/icons/EyeSlash";
|
import EyeSlash from "~/components/icons/EyeSlash";
|
||||||
@@ -23,7 +23,7 @@ type UserProfile = {
|
|||||||
hasPassword: boolean;
|
hasPassword: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkAuth = cache(async () => {
|
const checkAuth = query(async () => {
|
||||||
"use server";
|
"use server";
|
||||||
const { checkAuthStatus } = await import("~/server/utils");
|
const { checkAuthStatus } = await import("~/server/utils");
|
||||||
const event = getEvent()!;
|
const event = getEvent()!;
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
A,
|
A,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
useSearchParams,
|
useSearchParams,
|
||||||
cache,
|
redirect,
|
||||||
redirect
|
query
|
||||||
} from "@solidjs/router";
|
} from "@solidjs/router";
|
||||||
import { Title, Meta } from "@solidjs/meta";
|
import { Title, Meta } from "@solidjs/meta";
|
||||||
import { getEvent } from "vinxi/http";
|
import { getEvent } from "vinxi/http";
|
||||||
@@ -17,7 +17,7 @@ import { isValidEmail, validatePassword } from "~/lib/validation";
|
|||||||
import { getClientCookie } from "~/lib/cookies.client";
|
import { getClientCookie } from "~/lib/cookies.client";
|
||||||
import { env } from "~/env/client";
|
import { env } from "~/env/client";
|
||||||
|
|
||||||
const checkAuth = cache(async () => {
|
const checkAuth = query(async () => {
|
||||||
"use server";
|
"use server";
|
||||||
const { checkAuthStatus } = await import("~/server/utils");
|
const { checkAuthStatus } = await import("~/server/utils");
|
||||||
const event = getEvent()!;
|
const event = getEvent()!;
|
||||||
@@ -333,25 +333,31 @@ export default function LoginPage() {
|
|||||||
/>
|
/>
|
||||||
<div class="flex h-dvh flex-row justify-evenly">
|
<div class="flex h-dvh flex-row justify-evenly">
|
||||||
{/* Main content */}
|
{/* Main content */}
|
||||||
<div class="pt-12 md:pt-24">
|
<div class="relative pt-12 md:pt-24">
|
||||||
{/* Error message */}
|
{/* Error message */}
|
||||||
<div class="absolute -mt-12 text-center text-red-400 italic">
|
<Show when={error()}>
|
||||||
<Show when={error() === "passwordMismatch"}>
|
<div class="mb-4 w-full max-w-md rounded-lg border border-red-500 bg-red-500/10 px-4 py-3 text-center">
|
||||||
<div class="text-3xl">Passwords did not match!</div>
|
<Show when={error() === "passwordMismatch"}>
|
||||||
</Show>
|
<div class="text-lg font-semibold text-red-500">
|
||||||
<Show when={error() === "duplicate"}>
|
Passwords did not match!
|
||||||
<div class="text-3xl">Email Already Exists!</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<Show
|
<Show when={error() === "duplicate"}>
|
||||||
when={
|
<div class="text-lg font-semibold text-red-500">
|
||||||
error() &&
|
Email Already Exists!
|
||||||
error() !== "passwordMismatch" &&
|
</div>
|
||||||
error() !== "duplicate"
|
</Show>
|
||||||
}
|
<Show
|
||||||
>
|
when={
|
||||||
<div class="max-w-md px-4 text-base">{error()}</div>
|
error() &&
|
||||||
</Show>
|
error() !== "passwordMismatch" &&
|
||||||
</div>
|
error() !== "duplicate"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div class="text-sm text-red-500">{error()}</div>
|
||||||
|
</Show>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
<div class="py-2 pl-6 text-2xl md:pl-0">
|
<div class="py-2 pl-6 text-2xl md:pl-0">
|
||||||
|
|||||||
Reference in New Issue
Block a user