Skip to content

Commit

Permalink
bugfix uploader setfile undefined filename
Browse files Browse the repository at this point in the history
Signed-off-by: Duncan Ragsdale <[email protected]>
  • Loading branch information
Thistleman committed Aug 7, 2024
1 parent c144e18 commit b0bc926
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 11 additions & 6 deletions src/app/modules/analyses/upload/uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ export default function SubmissionUploader(
setUploadSuccess({
success: true,
});
setFile({
setFile((prevState) => ({
...prevState,
file: null,
});
}));
} else {
setUploadSuccess({
success: false,
Expand All @@ -130,16 +131,20 @@ export default function SubmissionUploader(
const fileTypes = ['ZIP', 'GZ'];

const uploadFile = (fileObject: File) => {
setFile({
setFile((prevState) => ({
...prevState,
name: fileObject.name,
file: fileObject,
});
}));
};

const handleActive = () => file !== null;

const handleClear = () => setFile({
const handleClear = () => setFile((prevState) => ({
...prevState,
name: '',
file: null,
});
}));
return (
<div className='
grid
Expand Down
2 changes: 0 additions & 2 deletions src/services/analysis_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ const AnalysisService = {
formData.append('analysis_id', analysisId.toString()); // Convert analysisId to a string
formData.append('python_version', pythonVersion);

console.log('outside: ', altName);
if ( typeof(altName) === 'string' &&
altName !== undefined &&
altName !== null &&
altName.length > 0 ) {
console.log(altName);
formData.append('alt_name', altName);
} else {
formData.append('alt_name', '');
Expand Down

0 comments on commit b0bc926

Please sign in to comment.