user log in finished

This commit is contained in:
Elijah Lucian
2021-07-15 22:00:26 -06:00
parent 18ebca4c0a
commit 4e6b393b23
8 changed files with 24274 additions and 1525 deletions
+3 -6
View File
@@ -4,21 +4,18 @@ import { Link } from 'react-router-dom'
import { Form } from '../../elements/Form'
import { Button } from '../../elements/Button'
import { useForm } from 'antd/lib/form/Form'
import { useAppContext } from '../../contexts/AppContext'
import { useUserContext } from '../../contexts/UserContext'
type FormValues = { username: string; password: string }
export const Login = () => {
const appContext = useAppContext()
const userContext = useUserContext()
const [form] = useForm<FormValues>()
const handleFinish = async ({ username, password }: FormValues) => {
try {
const res = await appContext.post('/dj-rest-auth/login/', {
username,
password,
})
const res = await userContext.handleLogin(username, password)
console.log('logging in', res)
} catch (err) {
console.log('error logging in')