Merge pull request #1 from TMSchipper/fix/response-data

feat: add response.data and fix styling for layout with download zip …
pull/94/head
Alexander Engel 2024-10-16 09:34:16 -07:00 committed by GitHub
commit a794d30892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -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>
);
};
@ -53,6 +53,9 @@ const ActionButtonsStyling = styled.div`
> button {
margin-right: 10px;
}
> button:last-of-type {
margin-left: auto;
}
`;
export default ActionButtons;

View File

@ -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' });