mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 22:16:20 +00:00
refactor json object check
This commit is contained in:
parent
4020d4d6c1
commit
eb8de02ed0
@ -57,6 +57,15 @@ class Console extends Component {
|
||||
)
|
||||
}
|
||||
|
||||
isJsonObject(item) {
|
||||
if (!item.result) return false;
|
||||
try {
|
||||
return typeof(JSON.parse(item.result)) === 'object'
|
||||
} catch(_err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
renderTabs() {
|
||||
const {processLogs, processes} = this.props;
|
||||
|
||||
@ -70,7 +79,7 @@ class Console extends Component {
|
||||
.reverse()
|
||||
.map((item, i) => {
|
||||
|
||||
if (item.result && (item.result[0] === "{" || item.result[0] === "[")) {
|
||||
if (this.isJsonObject(item)) {
|
||||
return(
|
||||
<div>
|
||||
<p key={i} className={item.logLevel} dangerouslySetInnerHTML={{__html: (convert.toHtml(item.command || ""))}}></p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user