Skip to content

Commit

Permalink
fix: export function for preparing payload for copy DHIS2-15722 (#1573)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
edoardo authored Sep 25, 2023
1 parent 2e07397 commit a1f8d69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/FileMenu/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit a1f8d69

Please sign in to comment.