How to use the grommet/utils/Rest.get function in grommet

To help you get started, we’ve selected a few grommet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github grommet / grommet-people-finder / src / js / components / Map.js View on Github external
} else if (attempts === 4) {
        params = {
          country: props.country,
          format: 'json',
        };
      }

      // need to change map zoom depending on the number of attempts
      const mapSize = {
        1: 14,
        2: 10,
        3: 10,
        4: 5,
      };

      Rest
        .get(
          `${window.location.protocol}//nominatim.openstreetmap.org/search`,
          params
        )
        .end((err, res) => {
          if (!err && res.ok && res.body && res.body[0]) {
            const place = res.body[0];
            this.setState(
              { latitude: place.lat, longitude: place.lon, busy: false },
              this.setMap.bind(this, mapSize[attempts])
            );
          } else if (attempts < 4) {
            this.getGeocode(props, ++attempts);
          } else {
            console.log('!!! geocode response error', err, res);
            if (this.state.map) {
github grommet / grommet-ferret / src / js / RestWatch.js View on Github external
_getREST: function(request) {
    console.log('!!! RestWatch _getREST');
    request.pollBusy = true;
    Rest.get(request.url, request.params)
      .end(function(err, res) {
        console.log('!!! RestWatch end', err, res);
        if (err) {
          throw err;
        }

        if (res.ok) {
          request.handler(res.body);
        }
        request.pollBusy = false;
      });
  },
github grommet / grommet-ferret / src / js / server-profiles / ServerProfileDelete.js View on Github external
_onDeleteResponse: function (err, res) {
    if (err) {
      throw err;
    }

    if (res.ok) {
      Rest.get(res.body.taskUri).end(this._onTaskResponse);
    }
  },
github grommet / grommet / examples / people-finder / src / js / components / DirectoryList.js View on Github external
Object.keys(config.scopes).map(function (key) {
        var scope = config.scopes[key];
        if (scope.ou !== this.props.scope.ou) {
          params.base = encodeURIComponent('ou=' + scope.ou + ',o=' + config.organization);
          params.filter = encodeURIComponent(scope.filterForSearch(searchText));
          params.attributes = config.attributesFromSchema(scope.schema);
          Rest.get('/ldap/', params).end(function (err, res) {
            this._onSearchResponse(scope, err, res);
          }.bind(this));
        }
      }.bind(this));
    }.bind(this), 200);
github grommet / grommet-ferret / src / js / server-profiles / ServerProfileDelete.js View on Github external
_getData: function () {
    Rest.get(this.state.uri).end(this._onGetResponse);
  },
github grommet / grommet-ferret / src / js / server-profiles / ServerProfileEdit.js View on Github external
_getData: function () {
    Rest.get(this.state.uri).end(this._onGetResponse);
  },
github grommet / grommet-ferret / src / js / actions.js View on Github external
return function (dispatch) {
    dispatch({ type: DASHBOARD_SEARCH, text: text });
    if (text && text.length > 0) {
      let params = {
        start: 0,
        count: 5,
        query: text
      };
      Rest.get('/rest/index/search-suggestions', params).end((err, res) => {
        if (err) {
          throw err;
        } else if (res.ok) {
          dispatch({ type: DASHBOARD_SEARCH_SUCCESS, result: res.body });
        }
      });
    }
  };
}
github grommet / grommet-ferret / src / js / Overview.js View on Github external
_getData: function () {
    Rest.get(this.state.uri).end(this._onResponse);
  },
github grommet / grommet / examples / medium-app / src / js / server-profiles / ServerProfileEdit.js View on Github external
_getData: function () {
    Rest.get(this.state.uri).end(this._onGetResponse);
  },
github grommet / grommet-ferret / src / js / components / server-profiles / ServerProfileConnectionAdd.js View on Github external
_onNetworkSearch: function (value) {
    var category;
    if ('Ethernet' === this.state.connection.type) {
      category = 'ethernet-networks';
    } else {
      category = 'fc-networks';
    }
    var params = {category: category, query: value,
      start: 0, count: 5};
    Rest.get('/rest/index/search-suggestions', params)
      .end(this._onNetworkSearchResponse);
  },