From a1f8d694121d62d001f7b4567d84d49ecec377fd Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Mon, 25 Sep 2023 15:28:35 +0200 Subject: [PATCH] fix: export function for preparing payload for copy DHIS2-15722 (#1573) * fix: export function for preparing payload for copy DHIS2-15722 * fix: make sure user is removed from payload Better than relying on apps not fetching the user information when loading a visualization. --- src/components/FileMenu/utils.js | 9 +++++++++ src/index.js | 1 + 2 files changed, 10 insertions(+) diff --git a/src/components/FileMenu/utils.js b/src/components/FileMenu/utils.js index 7cca04a9d..424f7f43e 100644 --- a/src/components/FileMenu/utils.js +++ b/src/components/FileMenu/utils.js @@ -39,3 +39,12 @@ export const appPathFor = (fileType, id) => { return `${window.location.search}${window.location.hash}` } } + +export const preparePayloadForSaveAs = ({ ...visualization }) => { + delete visualization.id + delete visualization.created + delete visualization.createdBy + delete visualization.user + + return visualization +} diff --git a/src/index.js b/src/index.js index 069656b77..8db29cbb2 100644 --- a/src/index.js +++ b/src/index.js @@ -22,6 +22,7 @@ export { default as DimensionMenu } from './components/DimensionMenu.js' export { default as PivotTable } from './components/PivotTable/PivotTable.js' export { default as FileMenu } from './components/FileMenu/FileMenu.js' +export { preparePayloadForSaveAs } from './components/FileMenu/utils.js' export { default as VisTypeIcon } from './components/VisTypeIcon.js'