Switch to biome for fomatting
This commit is contained in:
parent
ea6f62c9d6
commit
91aaddda5f
8 changed files with 144 additions and 30 deletions
|
|
@ -6,6 +6,8 @@ import { createUser, getUser } from '@/lib/db/queries';
|
|||
|
||||
import { signIn } from './auth';
|
||||
|
||||
|
||||
|
||||
const authFormSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().min(6),
|
||||
|
|
@ -61,7 +63,7 @@ export const register = async (
|
|||
password: formData.get('password'),
|
||||
});
|
||||
|
||||
let [user] = await getUser(validatedData.email);
|
||||
const [user] = await getUser(validatedData.email);
|
||||
|
||||
if (user) {
|
||||
return { status: 'user_exists' } as RegisterActionState;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { NextAuthConfig } from 'next-auth';
|
||||
import type { NextAuthConfig } from 'next-auth';
|
||||
|
||||
export const authConfig = {
|
||||
pages: {
|
||||
|
|
@ -11,10 +11,10 @@ export const authConfig = {
|
|||
],
|
||||
callbacks: {
|
||||
authorized({ auth, request: { nextUrl } }) {
|
||||
let isLoggedIn = !!auth?.user;
|
||||
let isOnChat = nextUrl.pathname.startsWith('/');
|
||||
let isOnRegister = nextUrl.pathname.startsWith('/register');
|
||||
let isOnLogin = nextUrl.pathname.startsWith('/login');
|
||||
const isLoggedIn = !!auth?.user;
|
||||
const isOnChat = nextUrl.pathname.startsWith('/');
|
||||
const isOnRegister = nextUrl.pathname.startsWith('/register');
|
||||
const isOnLogin = nextUrl.pathname.startsWith('/login');
|
||||
|
||||
if (isLoggedIn && (isOnLogin || isOnRegister)) {
|
||||
return Response.redirect(new URL('/', nextUrl as unknown as URL));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { toast } from 'sonner';
|
|||
import { AuthForm } from '@/components/auth-form';
|
||||
import { SubmitButton } from '@/components/submit-button';
|
||||
|
||||
import { register, RegisterActionState } from '../actions';
|
||||
import { register, type RegisterActionState } from '../actions';
|
||||
|
||||
export default function Page() {
|
||||
const router = useRouter();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue