adapting and shit
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user