|
|
@@ -108,10 +108,11 @@ class Schema extends Component {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
request('http://123.206.193.98:3000/graphql', SEARCH_SCHEMA, {id: referenceID}).then(
|
|
|
data => {
|
|
|
+ console.log(data);
|
|
|
if (data.schema_by_id !== null) {
|
|
|
- localStorage.setItem('ecommerce', data.caseSchema[2].schemaData);
|
|
|
- localStorage.setItem('subscribe', data.caseSchema[0].schemaData);
|
|
|
- localStorage.setItem('bills', data.caseSchema[1].schemaData);
|
|
|
+ localStorage.setItem('ecommerce', data.caseSchema.find(obj=>obj.schemaName==='ecommerce').schemaData);
|
|
|
+ localStorage.setItem('subscribe', data.caseSchema.find(obj=>obj.schemaName==='subscribe').schemaData);
|
|
|
+ localStorage.setItem('bills', data.caseSchema.find(obj=>obj.schemaName==='bills').schemaData);
|
|
|
resolve(data.schema_by_id.schemaData);
|
|
|
}
|
|
|
}
|
|
|
@@ -332,6 +333,7 @@ class Schema extends Component {
|
|
|
<DeleteSchemaButton
|
|
|
userID={userID}
|
|
|
schemaName={this.state.schemaName}
|
|
|
+ history={this.props.history}
|
|
|
/>
|
|
|
</div>
|
|
|
}
|
|
|
@@ -369,6 +371,7 @@ class Schema extends Component {
|
|
|
showTablePagination={this.showTablePagination}
|
|
|
page={this.state.page}
|
|
|
pageSize={this.state.pageSize}
|
|
|
+ history={this.props.history}
|
|
|
/> :
|
|
|
<Table
|
|
|
currentTable={this.state.currentTable}
|
|
|
@@ -384,6 +387,7 @@ class Schema extends Component {
|
|
|
showTablePagination={this.showTablePagination}
|
|
|
page={this.state.page}
|
|
|
pageSize={this.state.pageSize}
|
|
|
+ history={this.props.history}
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
@@ -467,11 +471,15 @@ class DeleteSchemaButton extends Component {
|
|
|
}
|
|
|
|
|
|
showConfirm = (delete_schema, schemaName, userID) => {
|
|
|
+ let _this = this;
|
|
|
confirm({
|
|
|
title: 'Do you want to delete this schema?',
|
|
|
content: 'It cannot be found back!',
|
|
|
onOk() {
|
|
|
delete_schema({variables: {schemaName, user_id: userID}});
|
|
|
+ _this.props.history.push({
|
|
|
+ pathname: '/graphql-service',
|
|
|
+ });
|
|
|
},
|
|
|
onCancel() {
|
|
|
},
|