Skip to content

Commit

Permalink
Fix datablock fetching for new backend
Browse files Browse the repository at this point in the history
  • Loading branch information
bpedersen2 committed Sep 12, 2023
1 parent a97ca8e commit 341b6e3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions common/scicat-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ exports.Dataset = class {
*/

async find(filter) {
const jsonFilter = JSON.stringify(filter);
console.log(">>> Dataset.find filter", jsonFilter);
const url = jsonFilter
? baseUrl + "/datasets?filter=" + jsonFilter
: baseUrl + "/datasets";

const jsonFilter = JSON.stringify(filter? filter: {});
// console.log(">>> Dataset.find filter", jsonFilter);
const url = baseUrl + "/datasets?filter=" + jsonFilter;
const res = await superagent.get(url);
return JSON.parse(res.text);
}
Expand Down Expand Up @@ -70,10 +69,10 @@ exports.Dataset = class {
//console.log(">>> Dataset.findByIdFiles pid", encodedId);
//console.log(">>> Dataset.findByIdFiles filter", jsonFilter);
const url = jsonFilter
? baseUrl + "/Datasets/" + encodedId + "?filter=" + jsonFilter
: baseUrl + "/Datasets/" + encodedId;
? baseUrl + "/datasets/" + encodedId + "/origdatablocks?filter=" + jsonFilter
: baseUrl + "/datasets/" + encodedId + "/origdatablocks";
const res = await superagent.get(url);
return JSON.parse(res.text)["origdatablocks"];
return JSON.parse(res.text);
}
};

Expand Down

0 comments on commit 341b6e3

Please sign in to comment.