Commit ff88d5ba authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Merge branch 'jc/ead_basket_GET' into 'master'

ead basket fetch with get + basex64 encoding for query param

See merge request pdn-certic/MaX!107
parents 52fcf7f9 1958e5ea
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -115,11 +115,14 @@ declare function max.plugin.ead_basket:itemPorteDocuments($projectId, $item){
            "nodeId" : $nodeId})/*[1]
};


declare
%rest:path("/{$projectId}/ead/fetch_basket_data.html")
%output:method("html")
%rest:POST("{$itemsList}")
function max.plugin.ead_basket:basketData($projectId, $itemsList){
%rest:query-param("itemsList", "{$itemsListb64}")
%rest:GET
function max.plugin.ead_basket:basketData($projectId, $itemsListb64 as xs:base64Binary){
    let $itemsList := json:parse(convert:binary-to-string(xs:base64Binary($itemsListb64)))
    for $items in $itemsList/json/_
    group by $docName := fn:substring-before($items, "|")
    let $dbPath := max.config:getProjectDBPath($projectId)
+3 −8
Original line number Diff line number Diff line
@@ -70,13 +70,8 @@ class EADDocumentsBasket {
    }

    async hydrateItems() {
        let response = await fetch(baseURI  + "/ead/fetch_basket_data.html", {
            method: "post",
            headers: {
                'Accept': 'application/xml',
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(this.items())
        let response = await fetch(baseURI  + "/ead/fetch_basket_data.html?itemsList=" + btoa(JSON.stringify(this.items())), {
            method: "GET",
        });
        return await response.text()
    }