From f14597772029972023b8848155e2490fce242691 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Mon, 4 Nov 2024 14:48:24 +0100 Subject: [PATCH] login-template: Try rw-type --- docs/r/login-template.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/r/login-template.json b/docs/r/login-template.json index bf43030..0db34a6 100644 --- a/docs/r/login-template.json +++ b/docs/r/login-template.json @@ -7,7 +7,8 @@ { "path": "dbAuth/login.tsx.template", "content": "import { useEffect, useRef } from 'react'\n\nimport {\n FieldError,\n Form,\n Label,\n PasswordField,\n TextField,\n} from '@redwoodjs/forms'\nimport { Link, navigate, routes } from '@redwoodjs/router'\nimport { Metadata } from '@redwoodjs/web'\nimport { Toaster, toast } from '@redwoodjs/web/toast'\n\nimport { useAuth } from 'src/auth'\nimport { Button } from '@/registry/default/ui/Button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/ui/Card'\n\nconst LoginPage = () => {\n const { isAuthenticated, logIn } = useAuth()\n\n useEffect(() => {\n if (isAuthenticated) {\n navigate(routes.home())\n }\n }, [isAuthenticated])\n\n const ${usernameCamelCase}Ref = useRef(null)\n useEffect(() => {\n ${usernameCamelCase}Ref.current?.focus()\n }, [])\n\n const onSubmit = async (data: Record) => {\n const response = await logIn({ username: data.${usernameCamelCase}, password: data.${passwordCamelCase} })\n\n if (response.message) {\n toast(response.message)\n } else if (response.error) {\n toast.error(response.error)\n } else {\n toast.success('Welcome back!')\n }\n }\n\n return (\n <>\n \n\n
\n \n \n \n Login\n \n Enter your ${usernameTitleCase} below to login to your account\n \n \n \n
\n
\n
\n \n ${usernameTitleCase}\n \n \n\n \n
\n\n
\n \n ${passwordTitleCase}\n \n \n\n
\n \n Forgot ${passwordTitleCase}?\n \n
\n\n \n
\n\n \n
\n
\n
\n
\n
\n Don't have an account?{' '}\n \n Sign up!\n \n
\n
\n \n )\n}\n\nexport default LoginPage\n", - "type": "registry:template", + "type": "registry:example", + "rw-type": "registry:template", "target": "src/pages/LoginPage/LoginPage.tsx" } ]