dependent-tan
dependent-tan13mo ago

getting 404 error when i click on create property button

these are my files import {useState} from 'react' import { FieldValues, useForm } from '@pankod/refine-react-hook-form' import { useNavigate } from 'react-router-dom' import Form from 'components/common/Form'; import { useGetIdentity } from '@pankod/refine-core'; const CreateProperty = () => { const navigate = useNavigate(); const {data: user} = useGetIdentity(); const [propertyImage, setPropertyImage] = useState({ name: '', url: ''}); const { refineCore: {onFinish, formLoading}, register, handleSubmit} = useForm(); const handleImageChange = () => {} const onFinishHandler = () => {} return ( <Form type="Create" register={register} onFinish={onFinish} formLoading={formLoading} handleSubmit={handleSubmit} handleImageChange={handleImageChange} onFinishHandler={onFinishHandler} propertyImage={propertyImage} /> ) } export default CreateProperty import {Box, Typography, FormControl, FormHelperText, TextField, TextareaAutosize, Stack, Select, MenuItem, Button} from '@pankod/refine-mui' import {FormProps} from 'interfaces/common' import CustomButton from './CustomButton' const Form = ({type, register, handleSubmit, handleImageChange, formLoading, onFinishHandler, propertyImage} : FormProps) => { return ( <div>Form</div> ) } export default Form
2 Replies
kapa.ai
kapa.ai13mo ago
Hi @jakshire01. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The code you provided seems to be missing some parts, such as the implementation of handleImageChange and onFinishHandler functions. Also, the onFinish function from useForm hook is used to handle form submission, and it should be provided with the data to be submitted. However, a 404 error typically indicates that the server couldn't find the requested resource. In the context of a "Create" operation, this could mean that the API endpoint you're trying to reach doesn't exist or isn't correct. You might want to check the following: 1. The URL of the API endpoint you're trying to reach. 2. The HTTP method (POST, GET, etc.) you're using to reach the endpoint. 3. The data you're sending in the request. Is it correctly formatted? Are all required fields included? You can refer to the refine documentation (https://refine.dev/docs) and blogs (https://refine.dev/blog) for more information on how to use refine's features. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai13mo ago
<@418995770205929473> kapa.ai is still learning and improving, please let us know how it did by reacting below

Did you find this page helpful?