reader.onloadend = function()

in client/src/js/RemoteVerifier.ts [85:113]


    reader.onloadend = function() {
      const framesEndpoint: string = Utils.getConfig().API_FRAMES_ENDPOINT_PATTERN.replace(
        "{challengeId}",
        challengeId
      );
      const url: string = Utils.getConfig().API_URL + framesEndpoint;

      Logger.info(`calling ${url}`);
      const dataUrl = reader.result as string;
      const requestData: FramesRequestData = {
        timestamp: Date.now(),
        frameBase64: dataUrl.substr(dataUrl.indexOf(",") + 1),
        token: token
      };
      Logger.info(requestData);
      const promise = axios.put(url, requestData);
      promise
        .then(function(response: any) {
          Logger.info(response);
          const verifyResponseData: FramesResponseData = response.data;
          Logger.info(verifyResponseData);
          Logger.info("frame successfully uploaded");
          resolve();
        })
        .catch(function(error: any) {
          Logger.error(error);
          reject(error);
        });
    };