add security to all admin endpoints

This commit is contained in:
Rick Watson
2019-05-29 23:48:16 +01:00
parent 71e5830d6c
commit 73433586b6
24 changed files with 264 additions and 230 deletions

View File

@@ -5,6 +5,7 @@ import { SCAN_NETWORKS_ENDPOINT, LIST_NETWORKS_ENDPOINT } from '../constants/E
import SectionContent from '../components/SectionContent';
import WiFiNetworkSelector from '../forms/WiFiNetworkSelector';
import {withNotifier} from '../components/SnackbarNotification';
import { redirectingAuthorizedFetch } from '../authentication/Authentication';
const NUM_POLLS = 10
const POLLING_FREQUENCY = 500
@@ -38,7 +39,7 @@ class WiFiNetworkScanner extends Component {
scanNetworks() {
this.pollCount = 0;
this.setState({scanningForNetworks:true, networkList: null, errorMessage:null});
fetch(SCAN_NETWORKS_ENDPOINT).then(response => {
redirectingAuthorizedFetch(SCAN_NETWORKS_ENDPOINT).then(response => {
if (response.status === 202) {
this.schedulePollTimeout();
return;
@@ -70,7 +71,7 @@ class WiFiNetworkScanner extends Component {
}
pollNetworkList() {
fetch(LIST_NETWORKS_ENDPOINT)
redirectingAuthorizedFetch(LIST_NETWORKS_ENDPOINT)
.then(response => {
if (response.status === 200) {
return response.json();