aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/reportManager/ReportManager.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-07-27 14:01:10 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-07-27 14:01:10 -0400
commitd655a8770ae4d4ff3cf08c433ac9068ed975aee4 (patch)
tree41a710f1034e8ef095b0a9fe10f59e8fe33d227c /src/client/util/reportManager/ReportManager.tsx
parent4ad1c765afcb0402f00ea6a91bf5811904e2a30e (diff)
parent23382da2326108b8c81906ec9b353b3493c20a21 (diff)
Merge branch 'sophie-report-manager' into sophie-ai-images
Diffstat (limited to 'src/client/util/reportManager/ReportManager.tsx')
-rw-r--r--src/client/util/reportManager/ReportManager.tsx16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/client/util/reportManager/ReportManager.tsx b/src/client/util/reportManager/ReportManager.tsx
index f20c2baaa..e684bd637 100644
--- a/src/client/util/reportManager/ReportManager.tsx
+++ b/src/client/util/reportManager/ReportManager.tsx
@@ -124,15 +124,13 @@ export class ReportManager extends React.Component<{}> {
alert('Please fill out all required fields to report an issue.');
return;
}
- let formattedLinks: string[] = [];
this.setSubmitting(true);
+ let formattedLinks: string[] = [];
if (this.formData.mediaFiles.length > 0) {
const links = await uploadFilesToServer(this.formData.mediaFiles);
- console.log(links);
- if (!links) {
- return;
+ if (links) {
+ formattedLinks = links;
}
- formattedLinks = links;
}
const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', {
@@ -146,14 +144,12 @@ export class ReportManager extends React.Component<{}> {
// 201 status means success
if (req.status !== 201) {
alert('Error creating issue on github.');
- return;
+ } else {
+ await this.updateIssues();
+ alert('Successfully submitted issue.');
}
-
- // Reset fields
this.setFormData(emptyReportForm);
this.setSubmitting(false);
- await this.updateIssues();
- alert('Successfully submitted issue.');
}
/**