From a4fa5898160d6d623e1cf238faaf51b0d3e4a47a Mon Sep 17 00:00:00 2001 From: Dmitry Nalobin Date: Fri, 2 Oct 2020 20:07:01 +0400 Subject: [PATCH] Fix export all button for SQL datasources (#33) --- src/routes/tasks.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/routes/tasks.ts b/src/routes/tasks.ts index b4962cd..a16ab80 100644 --- a/src/routes/tasks.ts +++ b/src/routes/tasks.ts @@ -10,9 +10,9 @@ type TRequest = { data: Array<{ panelUrl: string, datasourceRequest: Datasource, - datasourceName: string + datasourceName: string, + target: object, }>, - target: object, user: string, } }; @@ -22,7 +22,6 @@ async function addTask(req: TRequest, res) { const from = parseInt(body.from); const to = parseInt(body.to); const data = body.data; - const targets = [body.target]; const user = body.user; if(isNaN(from) || isNaN(to)) { @@ -34,7 +33,7 @@ async function addTask(req: TRequest, res) { res.status(200).send(`Exporting ${names} data from ${new Date(from).toLocaleString()} to ${new Date(to).toLocaleString()}`); data.forEach(request => { - const target = new Target(request.panelUrl, user, request.datasourceRequest, targets, from, to, request.datasourceName); + const target = new Target(request.panelUrl, user, request.datasourceRequest, [request.target], from, to, request.datasourceName); target.export(); }); }