diff --git a/config/default.js b/config/default.js index eec7c888a2..1e4f3b5492 100644 --- a/config/default.js +++ b/config/default.js @@ -116,7 +116,6 @@ module.exports = { FORUMS_VANILLA: 'https://vanilla.topcoder-dev.com', HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles', SUBMISSION_REVIEW: 'https://submission-review.topcoder-dev.com', - SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder-dev.com', THRIVE: 'https://community-app.topcoder-dev.com/thrive', diff --git a/config/production.js b/config/production.js index 25e837026c..6f068449ec 100644 --- a/config/production.js +++ b/config/production.js @@ -35,7 +35,6 @@ module.exports = { FORUMS_VANILLA: 'https://discussions.topcoder.com', HELP: 'https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles', SUBMISSION_REVIEW: 'https://submission-review.topcoder.com', - SUBMISSION_REVIEW_API_URL: 'https://submission-review-api.topcoder.com', MEMBER: 'https://member.topcoder.com', ONLINE_REVIEW: 'https://software.topcoder.com', PAYMENT_TOOL: 'https://payment.topcoder.com', diff --git a/src/shared/containers/SubmissionManagement/index.jsx b/src/shared/containers/SubmissionManagement/index.jsx index 7ecc153b6f..0e7869781d 100644 --- a/src/shared/containers/SubmissionManagement/index.jsx +++ b/src/shared/containers/SubmissionManagement/index.jsx @@ -15,11 +15,13 @@ import PT from 'prop-types'; import { connect } from 'react-redux'; import { Modal } from 'topcoder-react-ui-kit'; import { config } from 'topcoder-react-utils'; -import { actions } from 'topcoder-react-lib'; +import { actions, services } from 'topcoder-react-lib'; import './styles.scss'; import smpActions from '../../actions/page/submission_management'; +const { getService } = services.submissions; + // The container component class SubmissionManagementPageContainer extends React.Component { componentDidMount() { @@ -68,16 +70,17 @@ class SubmissionManagementPageContainer extends React.Component { onShowDetails, onDelete: onSubmissionDelete, onDownload: (challengeType, submissionId) => { - // download large file using stream method - const downloadSubmissionURL = `${config.URL.SUBMISSION_REVIEW_API_URL}/challengeSubmissions/${submissionId}/download?token=${authTokens.tokenV3}`; - - const link = document.createElement('a'); - link.href = downloadSubmissionURL; - link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`); - - document.body.appendChild(link); - link.click(); - link.parentNode.removeChild(link); + const submissionsService = getService(authTokens.tokenV3); + submissionsService.downloadSubmission(submissionId) + .then((blob) => { + const url = window.URL.createObjectURL(new Blob([blob])); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `submission-${challengeType}-${submissionId}.zip`); + document.body.appendChild(link); + link.click(); + link.parentNode.removeChild(link); + }); }, onlineReviewUrl: `${config.URL.ONLINE_REVIEW}/review/actions/ViewProjectDetails?pid=${challengeId}`, challengeUrl: `${challengesUrl}/${challengeId}`,