adapting and shit

This commit is contained in:
Elijah Lucian
2021-07-13 17:47:28 -06:00
parent 1af8209b99
commit 2b94223389
35 changed files with 163 additions and 160 deletions
+5 -10
View File
@@ -1,15 +1,10 @@
import { useState, useEffect } from 'react'
import { Password, User } from '../../types'
import '../../scss/form.scss'
import { useUserContext } from '../../contexts/UserContext'
import { useAppContext } from '../../contexts/AppContext'
import { useHistory } from 'react-router'
import { message } from 'antd'
export const UserForm = () => {
const history = useHistory()
const { api } = useAppContext()
const { user } = useUserContext()
console.log(user)
@@ -43,11 +38,11 @@ export const UserForm = () => {
}
try {
user?.id
? await api.updateUser(user.id, body)
: await api.createUser(body)
if (!user?.id) history.push('/login')
// user?.id
// ? await api.updateUser(user.id, body)
// : await api.createUser(body)
console.log('User form wtf')
// if (!user?.id) history.push('/login')
} catch (err) {
message.error('Something went wrong')
}