Skip to content

Commit

Permalink
Merge pull request #157 from com-pas/nsdoc-response
Browse files Browse the repository at this point in the history
Change processing of NSDOC File response
  • Loading branch information
Flurb authored May 10, 2022
2 parents 00f5bc2 + f0fc730 commit be190ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/compas-services/CompasValidatorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ export function CompasSclValidatorService() {
.then(parseXml);
},

getNsdocFile(id: string): Promise<string> {
getNsdocFile(id: string): Promise<Document> {
const svsUrl = getSclValidatorServiceUrl() + '/nsdoc/v1/' + id;
return fetch(svsUrl).catch(handleError)
.then(handleResponse);
.then(handleResponse)
.then(parseXml);
},
}
}
3 changes: 2 additions & 1 deletion src/compas/CompasNsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ async function processNsdocFile(id: string, nsdocId: string, filename: string, c
if (localStorage.getItem(nsdocId) === null || checksumStored === null || checksumStored !== checksum) {
console.info(`Loading NSDoc File '${nsdocId}' with ID '${id}'.`);
await CompasSclValidatorService().getNsdocFile(id)
.then(nsdocContent => {
.then(document => {
const nsdocContent = document.querySelectorAll("NsdocFile").item(0).textContent ?? '';
dispatchEventOnOpenScd(newLoadNsdocEvent(nsdocContent, filename));
localStorage.setItem(checksumKey, checksum);
})
Expand Down

0 comments on commit be190ce

Please sign in to comment.