@@ -43,7 +43,6 @@ export class EditorPage {
4343 . catch ( err => {
4444 this . loadingNodes = false ;
4545 this . nodeError = err ;
46- console . log ( err ) ;
4746 } ) ;
4847 } ;
4948
@@ -70,6 +69,14 @@ export class EditorPage {
7069 state . viewParameter . dispatch ( transactionToFormatParameter ) ;
7170 } ;
7271
72+ checkIfValidQuery ( value ) {
73+ const demoConstraints = [ "drop" , "addv" , "addvertex" , "addedge" , "adde" , "property" , "addlabel" ]
74+ demoConstraints . forEach ( constraint => {
75+ if ( value . toLowerCase ( ) . includes ( constraint ) ) {
76+ throw Error ( `You can not perform ${ constraint } operation in Demo mode!` )
77+ }
78+ } )
79+ }
7380 onClickRun = async ( ) => {
7481 if ( state . editorTextFlag ) {
7582 state . selectedNodeName = null ;
@@ -93,6 +100,9 @@ export class EditorPage {
93100
94101 if ( isValid ) {
95102 state . timeTaken = null ;
103+
104+ this . checkIfValidQuery ( query )
105+
96106 const res = await axios . post ( `${ state . hostUrl } /query/` , {
97107 query,
98108 parameters : JSON . parse ( parameters ) ,
@@ -108,9 +118,8 @@ export class EditorPage {
108118 state . errorMessage = error ;
109119 }
110120 } catch ( error ) {
111- console . log ( { error } ) ;
112121 state . isError = true ;
113- state . errorMessage = error ?. response ?. data ?. error ? error . response . data . error : 'Failed to fetch data from db server.' ;
122+ state . errorMessage = error ?. response ?. data ?. error ? error . response . data . error : error . message ?? 'Failed to fetch data from db server.' ;
114123 }
115124 state . isLoading = false ;
116125 }
0 commit comments