From 955ca75035aaa223fc8bc07416ca4c31e7a9d1c2 Mon Sep 17 00:00:00 2001 From: Sophie Zhang Date: Thu, 27 Jul 2023 13:39:22 -0400 Subject: removed new endpoint for now --- src/client/util/reportManager/ReportManager.tsx | 16 ++++++---------- src/client/util/reportManager/reportManagerUtils.ts | 5 +---- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'src') 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.'); } /** diff --git a/src/client/util/reportManager/reportManagerUtils.ts b/src/client/util/reportManager/reportManagerUtils.ts index d8344220f..45727e203 100644 --- a/src/client/util/reportManager/reportManagerUtils.ts +++ b/src/client/util/reportManager/reportManagerUtils.ts @@ -110,10 +110,7 @@ export const getServerPath = (link: any): string => { export const uploadFilesToServer = async (mediaFiles: FileData[]): Promise => { try { // need to always upload to browndash - const links = await Networking.UploadFilesToServer( - mediaFiles.map(file => ({ file: file.file })), - true - ); + const links = await Networking.UploadFilesToServer(mediaFiles.map(file => ({ file: file.file }))); return (links ?? []).map(getServerPath).map(fileLinktoServerLink); } catch (err) { if (err instanceof Error) { -- cgit v1.2.3-70-g09d2