Skip to content

Commit d2423df

Browse files
committed
always parse edit json
1 parent df474c1 commit d2423df

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

src/App.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ class App extends Component {
102102
}
103103

104104
finalApplicationJson(api) {
105+
if (typeof(api.application_json) == 'object') {
106+
api.application_json = JSON.stringify(api.application_json);
107+
}
105108
let newString = this.replaceVarInString(api, api.application_json);
106109
let result = {};
107110
if (newString) {

src/component/EditApiDialog.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ class EditApiDialog extends Component {
5555
}
5656

5757
onClickSave = ()=> {
58-
var dist = {}
59-
Object.assign(dist,this.state.api);
60-
try {
61-
dist['input'] = JSON.parse(dist.input);
62-
}
63-
catch (error) {
64-
dist['input'] = {}
65-
};
66-
67-
this.props.onSave(dist);
58+
var dst = {}
59+
Object.keys(this.state.api).forEach((ele) => {
60+
try {
61+
dst[ele] = JSON.parse(this.state.api[ele]);
62+
} catch (error) {
63+
dst[ele] = this.state.api[ele];
64+
}
65+
});
66+
67+
this.props.onSave(dst);
6868
}
6969

7070
inputChanged = (ele) => {

src/component/req_data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
const Host = '/testsets/';
3-
2+
//const Host = 'http://139.180.139.19:8999/testsets/';
3+
const Host = '/testsets/'
44

55
export function get_set_list(cb) {
66
fetch(Host).then((resp)=>{

0 commit comments

Comments
 (0)