🐛 fix(endpoints.tsx): change returned key from 'filename' to 'file_path' for consistency
🐛 fix(inputFileComponent): update the key used to set the file path to match the change in the backend
The key returned by the endpoint was changed from 'filename' to 'file_path' for consistency. The key used to set the file path in the frontend was updated to match the change in the backend.
This commit is contained in:
parent
fca22589a8
commit
f6dbc97d77
2 changed files with 4 additions and 4 deletions
|
|
@ -43,7 +43,7 @@ async def create_upload_file(file: UploadFile, client_id: str):
|
||||||
# Cache file
|
# Cache file
|
||||||
file_path = save_uploaded_file(file.file, file_name=client_id)
|
file_path = save_uploaded_file(file.file, file_name=client_id)
|
||||||
|
|
||||||
return {"filename": file_path}
|
return {"file_path": file_path}
|
||||||
|
|
||||||
|
|
||||||
# get endpoint to return version of langflow
|
# get endpoint to return version of langflow
|
||||||
|
|
|
||||||
|
|
@ -59,15 +59,15 @@ export default function InputFileComponent({
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log("File uploaded successfully");
|
console.log("File uploaded successfully");
|
||||||
// Get the file name from the response
|
// Get the file name from the response
|
||||||
const { filename } = data;
|
const { file_path } = data;
|
||||||
console.log("File name:", filename);
|
console.log("File name:", file_path);
|
||||||
|
|
||||||
// Update the state and callback with the name of the file
|
// Update the state and callback with the name of the file
|
||||||
// sets the value to the user
|
// sets the value to the user
|
||||||
setMyValue(file.name);
|
setMyValue(file.name);
|
||||||
onChange(file.name);
|
onChange(file.name);
|
||||||
// sets the value that goes to the backend
|
// sets the value that goes to the backend
|
||||||
onFileChange(filename);
|
onFileChange(file_path);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.error("Error occurred while uploading file");
|
console.error("Error occurred while uploading file");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue