Skip to content

Commit 622be5e

Browse files
committed
added http checking back to endpoint field to fix CORS issue
1 parent b3be94b commit 622be5e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/components/view/testsView.jsx

+6
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,16 @@ function showInstructions() {
168168
// updates the endpoint url in state when submit button is clicked
169169
function updateURL() {
170170
let url = document.getElementById('url').value;
171+
if (url.match(/http:\/\/.+/) || url.match(/https:\/\/.+/)) {
171172
dispatch({ type: ADD_APOLLO_SERVER_URI, payload: url });
172173
console.log('test updateURL', apolloServerURI);
173174
document.querySelector('#endpointStatus').innerHTML = `Current endpoint: ${document.getElementById('url').value}`;
174175
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+
}
175181
}
176182

177183
useEffect(() => {

0 commit comments

Comments
 (0)