diff --git a/package.json b/package.json index 1fb8968dd..14d1e138e 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "@emotion/styled": "11.13.0", "@graasp/chatbox": "3.1.0", "@graasp/map": "1.17.0", - "@graasp/query-client": "3.19.0", - "@graasp/sdk": "4.21.0", - "@graasp/translations": "1.32.0", + "@graasp/query-client": "3.20.0", + "@graasp/sdk": "4.22.0", + "@graasp/translations": "1.33.0", "@graasp/ui": "4.23.0", "@mui/icons-material": "5.16.4", "@mui/lab": "5.0.0-alpha.172", diff --git a/src/components/item/header/ItemHeaderActions.tsx b/src/components/item/header/ItemHeaderActions.tsx index b1039e2e9..d886797f1 100644 --- a/src/components/item/header/ItemHeaderActions.tsx +++ b/src/components/item/header/ItemHeaderActions.tsx @@ -71,7 +71,7 @@ const ItemHeaderActions = ({ itemId }: Props): JSX.Element | null => { )} - + { +export const DownloadButton = ({ item }: Props): JSX.Element => { const { t: translateBuilder } = useBuilderTranslation(); const { @@ -21,25 +21,26 @@ export const DownloadButton = ({ id, name }: Props): JSX.Element => { data, isSuccess, isLoading: isDownloading, - } = mutations.useExportZip(); + } = mutations.useExportItem(); useEffect(() => { if (isSuccess) { - const url = window.URL.createObjectURL(new Blob([data])); + const url = window.URL.createObjectURL(new Blob([data.data])); const link = document.createElement('a'); link.href = url; - link.setAttribute('download', `${name}.zip`); + + link.setAttribute('download', data.name); document.body.appendChild(link); link.click(); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [data, isSuccess, id]); + }, [data, isSuccess, item]); const handleDownload = () => { - downloadItem({ id }); + downloadItem({ id: item.id }); }; return ( - +