1+ import { toast } from 'react-toastify' ;
12import Axios from 'axios' ;
23import { actionType as T } from '../../reducer' ;
34import GraphLoadSave from './5-load-save' ;
@@ -46,8 +47,8 @@ class GraphServer extends GraphLoadSave {
4647 // this.setGraphML(graphXML);
4748 // });
4849 // } else {
49- // // eslint-disable-next-line no-alert
50- // alert ('Not on server');
50+ // // eslint-disable-next-line no-toast.success
51+ // toast.success ('Not on server');
5152 // }
5253 // }
5354
@@ -60,73 +61,73 @@ class GraphServer extends GraphLoadSave {
6061
6162 // });
6263 // } else {
63- // // eslint-disable-next-line no-alert
64- // alert ('Not on server');
64+ // // eslint-disable-next-line no-toast.success
65+ // toast.success ('Not on server');
6566 // }
6667 // }
6768
6869 build ( ) {
6970 // TODO
70- Axios . post ( ' http://127.0.0.1:5000/build/demo ?fetch=sample&apikey=xyz' )
71+ Axios . post ( ` http://127.0.0.1:5000/build/${ this . superState . uploadedDirName } ?fetch=${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
7172 . then ( ( res ) => { // eslint-disable-next-line
72- alert ( res . data [ 'message' ] )
73+ toast . success ( res . data [ 'message' ] )
7374 } ) . catch ( ( err ) => { // eslint-disable-next-line
74- alert ( err ) ;
75+ toast . success ( err ) ;
7576 } ) ;
7677 if ( this . serverID ) ;
7778 }
7879
7980 debug ( ) {
8081 // TODO
81- Axios . post ( ' http://127.0.0.1:5000/debug/demo' )
82+ Axios . post ( ` http://127.0.0.1:5000/debug/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
8283 . then ( ( res ) => { // eslint-disable-next-line
83- alert ( res . data [ 'message' ] )
84+ toast . success ( res . data [ 'message' ] )
8485 } ) . catch ( ( err ) => { // eslint-disable-next-line
85- alert ( err ) ;
86+ toast . success ( err ) ;
8687 } ) ;
8788 if ( this . serverID ) ;
8889 }
8990
9091 run ( ) {
9192 // TODO
92- Axios . post ( ' http://127.0.0.1:5000/run/demo' )
93+ Axios . post ( ` http://127.0.0.1:5000/run/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
9394 . then ( ( res ) => { // eslint-disable-next-line
94- alert ( res . data [ 'message' ] )
95+ toast . success ( res . data [ 'message' ] )
9596 } ) . catch ( ( err ) => { // eslint-disable-next-line
96- alert ( err ) ;
97+ toast . success ( err ) ;
9798 } ) ;
9899 if ( this . serverID ) ;
99100 }
100101
101102 clear ( ) {
102103 // TODO
103- Axios . post ( ' http://127.0.0.1:5000/clear/demo' )
104+ Axios . post ( ` http://127.0.0.1:5000/clear/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
104105 . then ( ( res ) => { // eslint-disable-next-line
105- alert ( res . data [ 'message' ] )
106+ toast . success ( res . data [ 'message' ] )
106107 } ) . catch ( ( err ) => { // eslint-disable-next-line
107- alert ( err ) ;
108+ toast . success ( err ) ;
108109 } ) ;
109110 if ( this . serverID ) ;
110111 }
111112
112113 stop ( ) {
113114 // TODO
114- Axios . post ( ' http://127.0.0.1:5000/stop/demo' )
115+ Axios . post ( ` http://127.0.0.1:5000/stop/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
115116 . then ( ( res ) => { // eslint-disable-next-line
116- alert ( res . data [ 'message' ] )
117+ toast . success ( res . data [ 'message' ] )
117118 } ) . catch ( ( err ) => { // eslint-disable-next-line
118- alert ( err ) ;
119+ toast . success ( err ) ;
119120 } ) ;
120121 if ( this . serverID ) ;
121122 }
122123
123124 destroy ( ) {
124125 // TODO
125- Axios . delete ( ' http://127.0.0.1:5000/destroy/demo' )
126+ Axios . delete ( ` http://127.0.0.1:5000/destroy/${ this . superState . graphs [ this . superState . curGraphIndex ] . fileName . split ( '.' ) [ 0 ] } ` )
126127 . then ( ( res ) => { // eslint-disable-next-line
127- alert ( res . data [ 'message' ] )
128+ toast . success ( res . data [ 'message' ] )
128129 } ) . catch ( ( err ) => { // eslint-disable-next-line
129- alert ( err ) ;
130+ toast . success ( err ) ;
130131 } ) ;
131132 if ( this . serverID ) ;
132133 }
0 commit comments