diff options
-rw-r--r-- | src/client/util/reportManager/ReportManager.tsx | 16 | ||||
-rw-r--r-- | src/client/util/reportManager/reportManagerUtils.ts | 5 |
2 files changed, 7 insertions, 14 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.'); } /** 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<string[] | undefined> => { 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) { |