Skip to content

Commit be190ce

Browse files
author
Rob Tjalma
authored
Merge pull request #157 from com-pas/nsdoc-response
Change processing of NSDOC File response
2 parents 00f5bc2 + f0fc730 commit be190ce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/compas-services/CompasValidatorService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ export function CompasSclValidatorService() {
5757
.then(parseXml);
5858
},
5959

60-
getNsdocFile(id: string): Promise<string> {
60+
getNsdocFile(id: string): Promise<Document> {
6161
const svsUrl = getSclValidatorServiceUrl() + '/nsdoc/v1/' + id;
6262
return fetch(svsUrl).catch(handleError)
63-
.then(handleResponse);
63+
.then(handleResponse)
64+
.then(parseXml);
6465
},
6566
}
6667
}

src/compas/CompasNsdoc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ async function processNsdocFile(id: string, nsdocId: string, filename: string, c
2121
if (localStorage.getItem(nsdocId) === null || checksumStored === null || checksumStored !== checksum) {
2222
console.info(`Loading NSDoc File '${nsdocId}' with ID '${id}'.`);
2323
await CompasSclValidatorService().getNsdocFile(id)
24-
.then(nsdocContent => {
24+
.then(document => {
25+
const nsdocContent = document.querySelectorAll("NsdocFile").item(0).textContent ?? '';
2526
dispatchEventOnOpenScd(newLoadNsdocEvent(nsdocContent, filename));
2627
localStorage.setItem(checksumKey, checksum);
2728
})

0 commit comments

Comments
 (0)