componentDidMount()

in frontend/mx/src/containers/device-provider.js [9:26]


  componentDidMount() {
    // Clear any previous data
    window.sessionStorage.clear();
     // Fetch device names
    axios
      .get(`${process.env.REACT_APP_MX_API}/api/mx`)
      .then(response => {
        let deviceId = response.headers && response.headers.deviceid;
        if (deviceId && typeof deviceId === 'string') {
          deviceId = deviceId.toLowerCase();
          this.setState({ deviceId });
        }
      })
      .catch(() => {
        // Problem loading device id
        console.warn('Unable to load device id from endpoint'); // eslint-disable-line
      });
  }