1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-11 03:34:35 +00:00

fix(web): parsing of webout

This commit is contained in:
Saad Jutt
2021-12-30 12:18:48 +05:00
parent 38193c83dd
commit a1151606f2

View File

@@ -48,13 +48,21 @@ const Studio = () => {
.then((res: any) => {
setLog(`<div><h2>SAS Log</h2><pre>${res?.data?.log}</pre></div>`)
const webout = res?.data?.webout
? JSON.parse(
res.data.webout
.split('>>weboutBEGIN<<')[1]
.split('>>weboutEND<<')[0]
)
: ''
let weboutString: string
try {
weboutString = res.data.webout
.split('>>weboutBEGIN<<')[1]
.split('>>weboutEND<<')[0]
} catch (_) {
weboutString = res.data.webout
}
let webout: any
try {
webout = JSON.parse(weboutString)
} catch (_) {
webout = weboutString
}
setWebout(`<pre><code>${JSON.stringify(webout, null, 4)}</code></pre>`)
setTab('2')