This commit is contained in:
Elijah Lucian
2021-07-15 15:13:43 -06:00
parent f0f4494553
commit 83fdd5b79a
5 changed files with 13 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ export const AppContextProvider = ({ children, baseURL }: Props) => {
const api = axios.create({ baseURL })
api.interceptors.request.use((config) => {
config.url += '?format=json'
// config.url += '?format=json'
return config
})

View File

@@ -5,19 +5,17 @@ import { Form } from '../../elements/Form'
import { Button } from '../../elements/Button'
import { useForm } from 'antd/lib/form/Form'
import { useAppContext } from '../../contexts/AppContext'
import { useStacks } from '../../hooks/getMany/useStacks'
type FormValues = { email: string; password: string }
type FormValues = { username: string; password: string }
export const Login = () => {
const appContext = useAppContext()
const stacks = useStacks('')
const [form] = useForm<FormValues>()
const handleFinish = async ({ email, password }: FormValues) => {
const handleFinish = async ({ username, password }: FormValues) => {
const res = await appContext.post('/dj-rest-auth/login', {
email,
username,
password,
})
console.log(res)
@@ -27,7 +25,7 @@ export const Login = () => {
<div className="login">
<Form onFinish={handleFinish} form={form}>
<h1>Log In</h1>
<FormItem label="email" name="email">
<FormItem label="username" name="username">
<Input />
</FormItem>
<FormItem label="Password" name="password">