Skip to content

Commit 4a4f4d2

Browse files
authored
Merge pull request #2313 from adityagarg06/fix/export_Project_As_Zip
fix/exportProjectAsZip
2 parents 09bd960 + 2d4ba62 commit 4a4f4d2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

client/modules/IDE/components/SketchList.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ import getSortedSketches from '../selectors/projects';
1818
import Loader from '../../App/components/loader';
1919
import Overlay from '../../App/components/Overlay';
2020
import AddToCollectionList from './AddToCollectionList';
21+
import getConfig from '../../../utils/getConfig';
2122

2223
import ArrowUpIcon from '../../../images/sort-arrow-up.svg';
2324
import ArrowDownIcon from '../../../images/sort-arrow-down.svg';
2425
import DownFilledTriangleIcon from '../../../images/down-filled-triangle.svg';
2526

27+
const ROOT_URL = getConfig('API_URL');
28+
2629
const formatDateCell = (date, mobile = false) =>
2730
dates.format(date, { showTime: !mobile });
2831

@@ -140,7 +143,13 @@ class SketchListRowBase extends React.Component {
140143
};
141144

142145
handleSketchDownload = () => {
143-
this.props.exportProjectAsZip(this.props.sketch.id);
146+
const { sketch } = this.props;
147+
const downloadLink = document.createElement('a');
148+
downloadLink.href = `${ROOT_URL}/projects/${sketch.id}/zip`;
149+
downloadLink.download = `${sketch.name}.zip`;
150+
document.body.appendChild(downloadLink);
151+
downloadLink.click();
152+
document.body.removeChild(downloadLink);
144153
};
145154

146155
handleSketchDuplicate = () => {
@@ -332,7 +341,6 @@ SketchListRowBase.propTypes = {
332341
deleteProject: PropTypes.func.isRequired,
333342
showShareModal: PropTypes.func.isRequired,
334343
cloneProject: PropTypes.func.isRequired,
335-
exportProjectAsZip: PropTypes.func.isRequired,
336344
changeProjectName: PropTypes.func.isRequired,
337345
onAddToCollection: PropTypes.func.isRequired,
338346
mobile: PropTypes.bool,

0 commit comments

Comments
 (0)