Skip to content

Commit

Permalink
try to fix file download bug
Browse files Browse the repository at this point in the history
  • Loading branch information
birdpump committed Jul 20, 2024
1 parent 19cfb79 commit 27a10ec
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions routes/admin/adminData.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,15 @@ adminRouter.get('/csv-action/gen-user-csv', async (req, res, next) => {
console.log("File path:", filePath);


res.download(filePath, 'users.csv', (err) => {
if (err) {
console.error('Error sending file:', err);
res.status(500).send('Error downloading file');
}
});
setTimeout(() => {
res.download(filePath, 'users.csv', (err) => {
if (err) {
console.error('Error sending file:', err);
res.status(500).send('Error downloading file');
}
});
}, 2000); // todo see if this actually fixed the issue

} catch (error) {
console.error('Error generating CSV:', error);
next(error);
Expand Down

0 comments on commit 27a10ec

Please sign in to comment.