Revert "Upgrade linter and formatter to Ultracite" (#1226)
This commit is contained in:
parent
0e320b391d
commit
1aff7d9868
177 changed files with 8334 additions and 6943 deletions
|
|
@ -1,51 +1,53 @@
|
|||
"use client";
|
||||
'use client';
|
||||
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useActionState, useEffect, useState } from "react";
|
||||
import { AuthForm } from "@/components/auth-form";
|
||||
import { SubmitButton } from "@/components/submit-button";
|
||||
import { toast } from "@/components/toast";
|
||||
import { type RegisterActionState, register } from "../actions";
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useActionState, useEffect, useState } from 'react';
|
||||
|
||||
import { AuthForm } from '@/components/auth-form';
|
||||
import { SubmitButton } from '@/components/submit-button';
|
||||
|
||||
import { register, type RegisterActionState } from '../actions';
|
||||
import { toast } from '@/components/toast';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
export default function Page() {
|
||||
const router = useRouter();
|
||||
|
||||
const [email, setEmail] = useState("");
|
||||
const [email, setEmail] = useState('');
|
||||
const [isSuccessful, setIsSuccessful] = useState(false);
|
||||
|
||||
const [state, formAction] = useActionState<RegisterActionState, FormData>(
|
||||
register,
|
||||
{
|
||||
status: "idle",
|
||||
}
|
||||
status: 'idle',
|
||||
},
|
||||
);
|
||||
|
||||
const { update: updateSession } = useSession();
|
||||
|
||||
useEffect(() => {
|
||||
if (state.status === "user_exists") {
|
||||
toast({ type: "error", description: "Account already exists!" });
|
||||
} else if (state.status === "failed") {
|
||||
toast({ type: "error", description: "Failed to create account!" });
|
||||
} else if (state.status === "invalid_data") {
|
||||
if (state.status === 'user_exists') {
|
||||
toast({ type: 'error', description: 'Account already exists!' });
|
||||
} else if (state.status === 'failed') {
|
||||
toast({ type: 'error', description: 'Failed to create account!' });
|
||||
} else if (state.status === 'invalid_data') {
|
||||
toast({
|
||||
type: "error",
|
||||
description: "Failed validating your submission!",
|
||||
type: 'error',
|
||||
description: 'Failed validating your submission!',
|
||||
});
|
||||
} else if (state.status === "success") {
|
||||
toast({ type: "success", description: "Account created successfully!" });
|
||||
} else if (state.status === 'success') {
|
||||
toast({ type: 'success', description: 'Account created successfully!' });
|
||||
|
||||
setIsSuccessful(true);
|
||||
updateSession();
|
||||
router.refresh();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [state.status, router.refresh, updateSession]);
|
||||
}, [state.status]);
|
||||
|
||||
const handleSubmit = (formData: FormData) => {
|
||||
setEmail(formData.get("email") as string);
|
||||
setEmail(formData.get('email') as string);
|
||||
formAction(formData);
|
||||
};
|
||||
|
||||
|
|
@ -61,14 +63,14 @@ export default function Page() {
|
|||
<AuthForm action={handleSubmit} defaultEmail={email}>
|
||||
<SubmitButton isSuccessful={isSuccessful}>Sign Up</SubmitButton>
|
||||
<p className="mt-4 text-center text-gray-600 text-sm dark:text-zinc-400">
|
||||
{"Already have an account? "}
|
||||
{'Already have an account? '}
|
||||
<Link
|
||||
className="font-semibold text-gray-800 hover:underline dark:text-zinc-200"
|
||||
href="/login"
|
||||
className="font-semibold text-gray-800 hover:underline dark:text-zinc-200"
|
||||
>
|
||||
Sign in
|
||||
</Link>
|
||||
{" instead."}
|
||||
{' instead.'}
|
||||
</p>
|
||||
</AuthForm>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue