-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from DocShow-AI/data_profile
begin work on data profiling
- Loading branch information
Showing
5 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useState } from 'react'; | ||
import axios from 'axios'; | ||
import { API_URL } from '../../utils/constants'; | ||
|
||
function FileUpload({ endpoint }) { | ||
const [selectedFiles, setSelectedFiles] = useState([]); | ||
|
||
const handleFileChange = (e) => { | ||
setSelectedFiles(e.target.files); | ||
} | ||
|
||
const handleUpload = async () => { | ||
const formData = new FormData(); | ||
for (let i = 0; i < selectedFiles.length; i++) { | ||
formData.append('files', selectedFiles[i]); | ||
} | ||
|
||
try { | ||
const response = await axios.post(`${API_URL}${endpoint}`, formData, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data' | ||
} | ||
}); | ||
console.log(response.data); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
|
||
return ( | ||
<div> | ||
<input type="file" multiple onChange={handleFileChange} /> | ||
<button onClick={handleUpload}>Upload</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default FileUpload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters