xy 7 lat temu
rodzic
commit
66545fe66b

+ 9 - 15
src/components/common/schema/Schema.jsx

@@ -112,6 +112,7 @@ class Schema extends Component {
                                                         schemaID={this.state.schemaID}
                                                         userID={userID}
                                                         schemaName={this.state.schemaName}
+                                                        history={this.props.history}
                                                     />
                                                     :
                                                     <div className={'schema'}>
@@ -458,21 +459,7 @@ class ModifySchemaNameInput extends Component {
         let userID = this.props.userID;
         let schemaName = this.props.schemaName;
         return (
-            <Mutation
-                mutation={gql(UPDATE_SCHEMA_NAME)}
-                update={(cache) => {
-                    let data = cache.readQuery({query: gql(SHOW_ALL_SCHEMA), variables: {user_id: userID}});
-                    console.log('a', data);
-                    console.log('b', schemaName);
-                    console.log(data.schema_by_props.findIndex(obj => obj.schemaName === schemaName));
-                    // data.schema_by_props[data.schema_by_props.findIndex(obj => obj.schemaName === schemaName)]= '';
-                    // cache.writeQuery({
-                    //     query: gql(SHOW_SCHEMA),
-                    //     variables: {user_id: userID},
-                    //     data
-                    // });
-                }}
-            >
+            <Mutation mutation={gql(UPDATE_SCHEMA_NAME)}>
                 {(update_schema, {loading, error}) => {
                     if (error)
                         return 'error';
@@ -494,6 +481,13 @@ class ModifySchemaNameInput extends Component {
                                             updateAt: new Date().getTime()
                                         }
                                     });
+                                    this.props.history.push({
+                                        pathname: `/graphql-service/my-create/${value}`,
+                                        state:{
+                                            schemaName:value,
+                                            schemaID:this.props.schemaID,
+                                        }
+                                    });
                                     this.props.clearEditSchemaName();
                                 }}
                             />

+ 1 - 1
src/components/trialCase/TrialCase.jsx

@@ -73,7 +73,7 @@ class TrialCase extends Component {
                             (() => {
                                 switch (this.state.menuLevel2) {
                                     case 'schema':
-                                        return <Schema userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} location={this.props.location}/>;
+                                        return <Schema userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
                                         return <Deploy userID={this.state.userID} schemaID={schemaID} schemaName={schemaName}/>;
                                     case 'graphql':