mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-26 21:51:06 +00:00
fix(@cockpit/explorer): slice contract function result string only if starts/ends with double-quote
Closes #1636.
This commit is contained in:
parent
d116549c32
commit
ac76a40a61
@ -133,6 +133,17 @@ class ContractFunction extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
formatResult(result) {
|
||||
result = JSON.stringify(result);
|
||||
if (result.startsWith('"')) {
|
||||
result = result.slice(1);
|
||||
}
|
||||
if (result.endsWith('"')) {
|
||||
result = result.slice(0, -1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (ContractFunction.isEvent(this.props.method)) {
|
||||
return <React.Fragment/>;
|
||||
@ -244,7 +255,7 @@ class ContractFunction extends Component {
|
||||
Result:
|
||||
<strong>
|
||||
<span className="contract-function-result">
|
||||
{JSON.stringify(contractFunction.result).slice(1, -1)}
|
||||
{this.formatResult(contractFunction.result)}
|
||||
</span>
|
||||
</strong>
|
||||
</ListGroupItem>
|
||||
|
Loading…
x
Reference in New Issue
Block a user