Skip to content

Commit 553a65c

Browse files
committed
fix requests
1 parent 136f976 commit 553a65c

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/client/components/Main/Main.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CSSTransitionGroup } from 'react-transition-group';
55

66
import { showLoadingMessage, hideLoadingMessage, showErrorMessage } from '../Store/Actions.js';
77

8-
import baseurl from '../../utils/baseUrl';
8+
import baseurl, { baseUrl } from '../../utils/baseUrl';
99

1010
import Editor from '../Editor/Editor';
1111
import SideBar from '../SideBar/SideBar';
@@ -63,7 +63,7 @@ class Main extends React.Component {
6363
}
6464

6565
getUrl(endPoint, parameters) {
66-
let url = baseurl + endPoint;
66+
let url = baseUrl + endPoint;
6767
const paramKeys = Object.keys(parameters);
6868

6969
if (paramKeys.length) {
@@ -75,12 +75,13 @@ class Main extends React.Component {
7575

7676
fetchData(url, type, body) {
7777
this.handleRequestPending();
78+
7879
fetch(url, body ? {
79-
body: JSON.stringify({request: body}),
80-
method: 'POST',
81-
headers:{
82-
'Content-Type': 'application/json'
83-
}
80+
body: JSON.stringify({ request: body }),
81+
method: 'POST',
82+
headers:{
83+
'Content-Type': 'application/json'
84+
}
8485
} : {})
8586
.then(res => res.json())
8687
.then(data => {
@@ -89,7 +90,7 @@ class Main extends React.Component {
8990
: this.handleRequestSuccess(data, type);
9091
})
9192
.catch(err => this.handleRequestFail(err));
92-
}
93+
}
9394

9495
handleRequestPending() {
9596
this.setState({
@@ -116,7 +117,7 @@ class Main extends React.Component {
116117
});
117118
}
118119

119-
if(type === 'Control Flow Graph') {
120+
if(type === 'Control Flow Graph Constructor' || 'Control Flow Graph Runtime') {
120121
this.setState({
121122
graphResponse: response,
122123
});
@@ -200,15 +201,16 @@ class Main extends React.Component {
200201
});
201202
}
202203

203-
handleControlFlowGraphClick() {
204+
handleControlFlowGraphClick(isConstructor) {
204205
const { name, path, code } = this.props;
205-
206+
console.log('isConstructor aaaaaaaaaaaaaaaa')
207+
console.log(isConstructor)
206208
const params = {
207209
name: name.replace('.sol', '').replace('.evm', ''),
208210
path: encodeURIComponent(path),
209-
'constructor': 'false'
211+
'constructor': `${isConstructor}`
210212
}
211-
this.fetchData(this.getUrl('cfg/source', params), 'Control Flow Graph', code);
213+
this.fetchData(this.getUrl('cfg/source', params), `Control Flow Graph ${isConstructor ? 'Constructor' : 'Runtime'}`, code);
212214

213215
document.removeEventListener('click', this.handleOutsideClick);
214216
}
@@ -303,7 +305,8 @@ class Main extends React.Component {
303305
<SideBar
304306
onDisassemblerClick={() => this.handleDisassemblerClick()}
305307
onTransactionDebuggerClick={() => this.handleTransactionDebuggerClick()}
306-
onControlFlowGraphClick={() => this.handleControlFlowGraphClick()}
308+
onControlFlowGraphRuntimeClick={() => this.handleControlFlowGraphClick(false)}
309+
onControlFlowGraphConstructorClick={() => this.handleControlFlowGraphClick(true)}
307310
onViewStorageClick={() => this.handleViewStorageClick()}
308311
/>
309312
</div>

0 commit comments

Comments
 (0)