fix: checks for export & refresh button

This commit is contained in:
diced 2022-10-17 17:20:54 -07:00
parent d78db306c5
commit 3a4802f09a
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
4 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,5 @@
import { RefreshCw } from 'react-feather';
export default function RefreshIcon({ ...props }) {
return <RefreshCw size={15} {...props} />;
}

View file

@ -30,6 +30,7 @@ import FlameshotIcon from './FlameshotIcon';
import GitHubIcon from './GitHubIcon';
import DiscordIcon from './DiscordIcon';
import EyeIcon from './EyeIcon';
import RefreshIcon from './RefreshIcon';
export {
ActivityIcon,
@ -64,4 +65,5 @@ export {
GitHubIcon,
DiscordIcon,
EyeIcon,
RefreshIcon,
};

View file

@ -3,7 +3,7 @@ import { useForm } from '@mantine/form';
import { randomId, useInterval } from '@mantine/hooks';
import { useModals } from '@mantine/modals';
import { showNotification, updateNotification } from '@mantine/notifications';
import { CrossIcon, DeleteIcon, FlameshotIcon, SettingsIcon, ShareXIcon } from 'components/icons';
import { CrossIcon, DeleteIcon, FlameshotIcon, RefreshIcon, SettingsIcon, ShareXIcon } from 'components/icons';
import DownloadIcon from 'components/icons/DownloadIcon';
import Link from 'components/Link';
import MutedText from 'components/MutedText';
@ -166,6 +166,13 @@ export default function Manage() {
loading: true,
message: 'If you have a lot of files, the export may take a while. The list of exports will be updated every 30s.',
});
} else {
showNotification({
title: 'Error exporting data',
message: res.error,
color: 'red',
icon: <CrossIcon />,
});
}
};
@ -279,6 +286,7 @@ export default function Manage() {
<Group>
<Button onClick={openDeleteModal} rightIcon={<DeleteIcon />} color='red'>Delete All Data</Button>
<ExportDataTooltip><Button onClick={exportData} rightIcon={<DownloadIcon />}>Export Data</Button></ExportDataTooltip>
<Button onClick={getExports} rightIcon={<RefreshIcon />}>Refresh</Button>
</Group>
<Card mt={22}>
{exports && exports.length ? (

View file

@ -18,6 +18,8 @@ async function handler(req: NextApiReq, res: NextApiRes) {
},
});
if (!files.length) return res.error('no files found');
const zip = new Zip();
const export_name = `zipline_export_${user.id}_${Date.now()}.zip`;
const write_stream = createWriteStream(tmpdir() + `/${export_name}`);