diff --git a/dashboard/15-final/app/ui/dashboard/log-out-button.tsx b/dashboard/15-final/app/ui/dashboard/log-out-button.tsx index aa34779..43994bd 100644 --- a/dashboard/15-final/app/ui/dashboard/log-out-button.tsx +++ b/dashboard/15-final/app/ui/dashboard/log-out-button.tsx @@ -1,15 +1,21 @@ -'use client'; import { PowerIcon } from '@heroicons/react/24/outline'; -import { signOut } from 'next-auth/react'; +import { signOut } from '@/auth'; -export default function LogOutButton() { +export default async function LogOutButton() { return ( - + + ); } diff --git a/dashboard/15-final/app/ui/login-form.tsx b/dashboard/15-final/app/ui/login-form.tsx index 0171cc8..8c41f07 100644 --- a/dashboard/15-final/app/ui/login-form.tsx +++ b/dashboard/15-final/app/ui/login-form.tsx @@ -1,40 +1,11 @@ -'use client'; - -import { signIn } from 'next-auth/react'; -import { useRouter } from 'next/navigation'; -import React, { useState } from 'react'; +import { signIn } from '@/auth'; import { lusitana } from '@/app/ui/fonts'; import AcmeLogo from '@/app/ui/acme-logo'; import { AtSymbolIcon, KeyIcon } from '@heroicons/react/24/outline'; import { Button } from './button'; import { ArrowRightIcon } from '@heroicons/react/20/solid'; -export default function LoginForm() { - const [email, setEmail] = useState(''); - const [password, setPassword] = useState(''); - const [error, setError] = useState(''); - const { replace } = useRouter(); - - const handleSubmit = async (e: { preventDefault: () => void }) => { - e.preventDefault(); - - try { - const res = await signIn('credentials', { - email, - password, - redirect: false, - }); - - if (res?.error) { - setError('Invalid Credentials'); - return; - } - - replace('/dashboard'); - } catch (error) { - console.log(error); - } - }; +export default async function LoginForm() { return (