async beginUploadImageWorkflow()

in source/console/src/App.js [105:135]


  async beginUploadImageWorkflow() {
    let appState = await Utils.getAppState(this.state.primaryAppStateUrl, this.state.secondaryAppStateUrl);
    appState = appState.toUpperCase();

    switch (appState) {
      case 'FENCED':
        // Write operations are not permitted when the application is in fenced mode
        alert('New photos can not currently be uploaded. Please try again in a few minutes')
        return;
      case 'ACTIVE':
        if (this.state.isSecondaryRegion) {
          // When the application is in ACTIVE mode, only allow write operations when the 
          // front-end is targeting the primary region
          alert('Please refresh the application to enable photo uploads');
          return;
        }
        break;
      case 'FAILOVER':
        if (!this.state.isSecondaryRegion) {
          // When the application is in FAILOVER mode, only allow write operations when the 
          // front-end is targeting the secondary region
          alert('Please refresh the application to enable photo uploads');
          return;
        }
        break;
      default:
        throw new Error(`Unsupported app state: ${appState}`);
    }

    this.setState({ showUploadImageModal: true })
  }