🌟 Fix download button (#210)

* Add auth cookie to avoid using auth token in the url
* Fix all download button 
* Refactor some of the places where we download file
This commit is contained in:
Anton Shepilov
2023-09-21 14:08:57 +02:00
committed by GitHub
parent 43a5dbddf1
commit d88feaaba8
14 changed files with 61 additions and 125 deletions
@@ -76,14 +76,14 @@ const routes: FastifyPluginCallback = (fastify: FastifyInstance, _options, next)
fastify.route({
method: "GET",
url: `${serviceUrl}/:id/download`,
preValidation: [fastify.authenticateOptional],
preValidation: [fastify.authenticate],
handler: documentsController.download.bind(documentsController),
});
fastify.route({
method: "GET",
url: `${serviceUrl}/download/zip`,
preValidation: [fastify.authenticateOptional],
preValidation: [fastify.authenticate],
handler: documentsController.downloadZip.bind(documentsController),
});