Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/dataloaders/DataLoaderUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@ async function loadBinaryData(datasource: string, name: string) {
}
//send json args and return json/array buffer response
export async function getPostData(url: string, args, return_type = "json") {
let headers = {
"Accept": "application/json,text/plain,*/*",
"Content-Type": "application/json"
}
if (window["CSRF_TOKEN"]) {
headers["X-CSRFToken"] = window["CSRF_TOKEN"];
}
const resp = await fetch(url, {
method: "POST",
body: JSON.stringify(args),
headers: {
"Accept": "application/json,text/plain,*/*",
"Content-Type": "application/json"
}
headers,
});
if (return_type === "json") {
return await resp.json();
Expand Down
10 changes: 7 additions & 3 deletions src/dataloaders/DataLoaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ function processArrayBuffer(data,columns,size){
function getArrayBufferDataLoader(url){
return async(columns,dataSource,size)=>{
//get the data
let headers = {
"Content-Type": "application/json"
}
if (window["CSRF_TOKEN"]) {
headers["X-CSRFToken"] = window["CSRF_TOKEN"];
}
const response = await fetch(url,{
method:"POST",
body:JSON.stringify({columns:columns,data_source:dataSource}),
headers: {
'Content-Type': 'application/json'
}
headers,
});
//the data is any arraybuffer containing each individual
//column's raw data
Expand Down
3 changes: 2 additions & 1 deletion src/modules/static_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const isPopout = urlParams.get('popout') === "true";
const dir = urlParams.get('dir') || (isPopout ? '' : flaskURL);
const root = dir.endsWith("/") ? dir.substring(0, dir.length-1) : dir;
//hack to load data from local API
const staticFolder = !dir.startsWith("/project");
const staticFolder = !(dir.startsWith("/project") || dir.startsWith("project"));

// set title of page to the data directory
document.title = !staticFolder ? 'MDV - local project' : `MDV - ${root}`;
Expand Down Expand Up @@ -80,5 +80,6 @@ async function loadData() {
});
}, 100);
}

datasources.forEach((ds, i) => extraFeatures(i));
};