All files / extensions/default/src/DicomWebDataSource dcm4cheeReject.js

5.88% Statements 1/17
0% Branches 0/3
25% Functions 1/4
5.88% Lines 1/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42  102x                                                                                
export default function (wadoRoot, getAuthrorizationHeader) {
  return {
    series: (StudyInstanceUID, SeriesInstanceUID) => {
      return new Promise((resolve, reject) => {
        // Reject because of Quality. (Seems the most sensible out of the options)
        const CodeValueAndCodeSchemeDesignator = `113001%5EDCM`;
 
        const url = `${wadoRoot}/studies/${StudyInstanceUID}/series/${SeriesInstanceUID}/reject/${CodeValueAndCodeSchemeDesignator}`;
 
        const xhr = new XMLHttpRequest();
        xhr.open('POST', url, true);
 
        const headers = getAuthrorizationHeader();
 
        for (const key in headers) {
          xhr.setRequestHeader(key, headers[key]);
        }
 
        //Send the proper header information along with the request
        // TODO -> Auth when we re-add authorization.
 
        console.log(xhr);
 
        xhr.onreadystatechange = function () {
          //Call a function when the state changes.
          Iif (xhr.readyState == 4) {
            switch (xhr.status) {
              case 204:
                resolve(xhr.responseText);
 
                break;
              case 404:
                reject('Your dataSource does not support reject functionality');
            }
          }
        };
        xhr.send();
      });
    },
  };
}