i can't add new property #4020
Closed
Codeine999
started this conversation in
General
Replies: 1 comment
-
Hello @Codeine999, I think this question isn't related to refine, you could be confusing repositories 😄 Feel free to re-open if it's relevant. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hello i got some trouble i can't add a new property but i can add users, i already connected with cloudinary when i submit form nothing happened not error and in my console is show data that i printed ask chatgpt i try a lot but it not work this my code
`import Property from "../mongodb/models/property.js";
import User from "../mongodb/models/user.js";
import mongoose from "mongoose";
import * as dotenv from "dotenv";
import { v2 as cloudinary } from "cloudinary";
dotenv.config();
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
});
const getAllProperties = async (req, res) => {};
const getPropertyDetail = async (req, res) => {};
const createProperty = async (req, res) => {
try {
const {
title,
description,
propertyType,
location,
price,
photo,
email,
} = req.body;
};
const updateProperty = async (req, res) => {};
const deleteProperty = async (req, res) => {};
export {
const CreateProperty = () => {
getAllProperties,
getPropertyDetail,
createProperty,
updateProperty,
deleteProperty,
}
const navigate = useNavigate();
const { data: user } = useGetIdentity();
const [propertyImage, setPropertyImage] = useState({ name: '', url: '' });
const { refineCore: { onFinish, formLoading }, register, handleSubmit } = useForm();
const handleImageChange = (file: File) => {
const reader = (readFile: File) =>
new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = () => resolve(fileReader.result as string);
fileReader.readAsDataURL(readFile);
});
};
const onFinishHandler = async (data: FieldValues) => {
if (!propertyImage.name) return alert("Please select an image");
};`
Beta Was this translation helpful? Give feedback.
All reactions