www/category-category-module-es5.js
/**
     * Returns a valid authentication token for the installation. Generates a new
     * token if one doesn't exist, is expired or about to expire.
     *
     * Should only be called if the Firebase Installation is registered.
     */
Returns a valid authentication token for the installation. Generates a new
token if one doesn't exist, is expired or about to expire.

Should only be called if the Firebase Installation is registered.
Returns a valid authentication token for the installation . Generates a new token if one doesn ' t exist is expired or about to expire . Should only be called if the Firebase Installation is registered .
function refreshAuthToken(dependencies, forceRefresh) {
      if (forceRefresh === void 0) {
        forceRefresh = false;
      }
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
        var tokenPromise, entry, authToken, _a;
        return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
          switch (_b.label) {
            case 0:
              return [4
              , update(dependencies.appConfig, function (oldEntry) {
                if (!isEntryRegistered(oldEntry)) {
                  throw ERROR_FACTORY.create("not-registered"
                  );
                }
                var oldAuthToken = oldEntry.authToken;
                if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
                  return oldEntry;
                } else if (oldAuthToken.requestStatus === 1
                ) {
                    tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh);
                    return oldEntry;
                  } else {
                  if (!navigator.onLine) {
                    throw ERROR_FACTORY.create("app-offline"
                    );
                  }
                  var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
                  tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry);
                  return inProgressEntry;
                }
              })];
            case 1:
              entry = _b.sent();
              if (!tokenPromise) return [3
              , 3];
              return [4
              , tokenPromise];
            case 2:
              _a = _b.sent();
              return [3
              , 4];
            case 3:
              _a = entry.authToken;
              _b.label = 4;
            case 4:
              authToken = _a;
              return [2
              , authToken];
          }
        });
      });
    }
function refreshAuthToken ( dependencies , forceRefresh ) { if ( forceRefresh === void 0 ) { forceRefresh = false ; } return Object ( tslib__WEBPACK_IMPORTED_MODULE_2__ [ "__awaiter" ] ) ( this , void 0 , void 0 , function ( ) { var tokenPromise , entry , authToken , _a ; return Object ( tslib__WEBPACK_IMPORTED_MODULE_2__ [ "__generator" ] ) ( this , function ( _b ) { switch ( _b . label ) { case 0 : return [ 4 , update ( dependencies . appConfig , function ( oldEntry ) { if ( ! isEntryRegistered ( oldEntry ) ) { throw ERROR_FACTORY . create ( "not-registered" ) ; } var oldAuthToken = oldEntry . authToken ; if ( ! forceRefresh && isAuthTokenValid ( oldAuthToken ) ) { return oldEntry ; } else if ( oldAuthToken . requestStatus === 1 ) { tokenPromise = waitUntilAuthTokenRequest ( dependencies , forceRefresh ) ; return oldEntry ; } else { if ( ! navigator . onLine ) { throw ERROR_FACTORY . create ( "app-offline" ) ; } var inProgressEntry = makeAuthTokenRequestInProgressEntry ( oldEntry ) ; tokenPromise = fetchAuthTokenFromServer ( dependencies , inProgressEntry ) ; return inProgressEntry ; } } ) ] ; case 1 : entry = _b . sent ( ) ; if ( ! tokenPromise ) return [ 3 , 3 ] ; return [ 4 , tokenPromise ] ; case 2 : _a = _b . sent ( ) ; return [ 3 , 4 ] ; case 3 : _a = entry . authToken ; _b . label = 4 ; case 4 : authToken = _a ; return [ 2 , authToken ] ; } } ) ; } ) ; }
Returns a valid authentication token for the installation.
Returns a valid authentication token for the installation .
/*yield*/ /* NOT_REGISTERED */ // There is a valid token in the DB. /* IN_PROGRESS */ // There already is a token request in progress. // No token or token expired. /* APP_OFFLINE */ /*break*/ /*yield*/ /*break*/ /*return*/