Remove debug messages and move data inflation into api fn

This commit is contained in:
Patrick Jentsch 2023-07-12 11:11:15 +02:00
parent 960f36c740
commit 203faa4257
2 changed files with 6 additions and 10 deletions

View File

@ -630,7 +630,11 @@ cqi.api.APIClient = class APIClient {
async ext_corpus_static_data(corpus) {
const fn_name = 'ext_corpus_static_data';
const fn_args = {corpus: corpus};
return await this.#request(fn_name, fn_args);
let compressedEncodedData = await this.#request(fn_name, fn_args);
let encodedData = pako.inflate(compressedEncodedData);
let textDecoder = new TextDecoder();
let data = textDecoder.decode(encodedData);
return JSON.parse(data);
}
/**

View File

@ -138,15 +138,7 @@ cqi.models.corpora.CorpusCollection = class CorpusCollection extends cqi.models.
/************************************************************************
* Custom additions for nopaque *
************************************************************************/
// returnValue.static_data = await this.client.api.ext_corpus_static_data(corpusName);
let tmp = await this.client.api.ext_corpus_static_data(corpusName);
console.log(tmp);
let inflated = pako.inflate(tmp);
console.log(inflated);
let decoder = new TextDecoder('utf-8');
console.log(decoder);
let decoded = decoder.decode(inflated);
returnValue.static_data = JSON.parse(decoded);
returnValue.static_data = await this.client.api.ext_corpus_static_data(corpusName);
return returnValue;
}