Skip to content
Snippets Groups Projects
Commit 90a68a83 authored by Gerhard le Roux's avatar Gerhard le Roux
Browse files

add cors and validation

parent 461b21a2
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) = ...@@ -11,7 +11,7 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) =
const handleClick = async () => { const handleClick = async () => {
const result = await fetch(options.url, { const result = await fetch(options.url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc. method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'no-cors', // no-cors, *cors, same-origin mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit credentials: 'same-origin', // include, *same-origin, omit
headers: { headers: {
...@@ -36,8 +36,12 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) = ...@@ -36,8 +36,12 @@ export const ButtonPanel: React.FC<Props> = ({ options, data, width, height }) =
setError(result.statusText); setError(result.statusText);
return; return;
} }
if (json['data']['executeCommand']['ok']) { if (json['path'] === options.test_path) {
if (json['module'] === options.test_module) {
if (json['test'] === options.test_name) {
alert('Command executed successfully. '); alert('Command executed successfully. ');
}
}
} else { } else {
setError(json['data']['executeCommand']['message']); setError(json['data']['executeCommand']['message']);
alert('Command failed!'); alert('Command failed!');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment