Skip to content

Commit

Permalink
Merge pull request #1 from TMSchipper/fix/response-data
Browse files Browse the repository at this point in the history
feat: add response.data and fix styling for layout with download zip …
  • Loading branch information
ae94 authored Oct 16, 2024
2 parents 3a71083 + 9911e78 commit a794d30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion admin/src/components/ActionButtons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const ActionButtons = () => {
)}
onSubmit={(force) => dispatch(exportAllConfig(partialDiff, toggleNotification, formatMessage, post, get))}
/>
<Button onClick={() => dispatch(downloadZip(toggleNotification, formatMessage, post, get))}>{formatMessage({ id: 'config-sync.Buttons.DownloadConfig' })}</Button>
{!isEmpty(partialDiff) && (
<Typography variant="epsilon">{Object.keys(partialDiff).length} {Object.keys(partialDiff).length === 1 ? "config change" : "config changes"}</Typography>
)}
<Button onClick={() => dispatch(downloadZip(toggleNotification, formatMessage, post, get))}>{formatMessage({ id: 'config-sync.Buttons.DownloadConfig' })}</Button>
</ActionButtonsStyling>
);
};
Expand All @@ -53,6 +53,9 @@ const ActionButtonsStyling = styled.div`
> button {
margin-right: 10px;
}
> button:last-of-type {
margin-left: auto;
}
`;

export default ActionButtons;
2 changes: 1 addition & 1 deletion admin/src/state/actions/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function downloadZip(toggleNotification, formatMessage, post, get) {
return async function(dispatch) {
dispatch(setLoadingState(true));
try {
const { message, base64Data, name } = await get('/config-sync/zip');
const { message, base64Data, name } = (await get('/config-sync/zip')).data;
toggleNotification({ type: 'success', message });
if (base64Data) {
saveAs(b64toBlob(base64Data, 'application/zip'), name, { type: 'application/zip' });
Expand Down

0 comments on commit a794d30

Please sign in to comment.