File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,16 @@ function showInstructions() {
168
168
// updates the endpoint url in state when submit button is clicked
169
169
function updateURL ( ) {
170
170
let url = document . getElementById ( 'url' ) . value ;
171
+ if ( url . match ( / h t t p : \/ \/ .+ / ) || url . match ( / h t t p s : \/ \/ .+ / ) ) {
171
172
dispatch ( { type : ADD_APOLLO_SERVER_URI , payload : url } ) ;
172
173
console . log ( 'test updateURL' , apolloServerURI ) ;
173
174
document . querySelector ( '#endpointStatus' ) . innerHTML = `Current endpoint: ${ document . getElementById ( 'url' ) . value } ` ;
174
175
document . querySelector ( '#endpointStatus' ) . classList . remove ( 'invisible' ) ;
176
+ document . getElementById ( 'url' ) . value = '' ;
177
+ } else {
178
+ document . querySelector ( '#endpointStatus' ) . innerHTML = "Endpoint must include http:// or https://" ;
179
+ document . querySelector ( '#endpointStatus' ) . classList . remove ( 'invisible' ) ;
180
+ }
175
181
}
176
182
177
183
useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments