From 1eec5ebcb5c970aef954e28a7a70ae37820c2c5f Mon Sep 17 00:00:00 2001 From: Antony Raj Date: Wed, 31 Jul 2024 23:38:29 +0800 Subject: [PATCH] using listing_id from props --- frontend/src/components/files/UploadImage.tsx | 3 ++- frontend/src/components/files/UploadURDF.tsx | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/files/UploadImage.tsx b/frontend/src/components/files/UploadImage.tsx index 79b1856f..7482633f 100644 --- a/frontend/src/components/files/UploadImage.tsx +++ b/frontend/src/components/files/UploadImage.tsx @@ -15,6 +15,7 @@ const MAX_FILE_MB = MAX_FILE_SIZE / 1024 / 1024; interface ImageUploadProps { onUploadSuccess: (url: string) => void; imageId?: string | null; + listing_id: string; } const ImageUploadComponent = (props: ImageUploadProps) => { @@ -101,7 +102,7 @@ const ImageUploadComponent = (props: ImageUploadProps) => { const { response, error } = await APICalls.upload(compressedFile, { artifact_type: "image", - listing_id: "5", + listing_id: props.listing_id, }); if (error) { diff --git a/frontend/src/components/files/UploadURDF.tsx b/frontend/src/components/files/UploadURDF.tsx index 308a197b..d32a7d25 100644 --- a/frontend/src/components/files/UploadURDF.tsx +++ b/frontend/src/components/files/UploadURDF.tsx @@ -4,7 +4,11 @@ import { useTheme } from "hooks/theme"; import React, { useEffect, useRef, useState } from "react"; import { Alert, Col } from "react-bootstrap"; -const URDFUploadComponent = () => { +interface URDFUploadProps { + listing_id: string; +} + +const URDFUploadComponent = (props: URDFUploadProps) => { const [selectedFile, setSelectedFile] = useState(null); const [uploadStatus, setUploadStatus] = useState(null); const [fileError, setFileError] = useState(null); @@ -109,8 +113,8 @@ const URDFUploadComponent = () => { formData.append("file", selectedFile); const { error } = await APICalls.upload(selectedFile, { - artifact_type: "image", - listing_id: "5", + artifact_type: "urdf", + listing_id: props.listing_id, }); if (error) {