How to use the grommet/utils/Rest.buildQuery 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 / Location.js View on Github external
getLocation(id) {
    const params = {
      url: config.ldapBaseUrl,
      base: `ou=${this.state.scope.ou},o=${config.organization}`,
      scope: 'sub',
      filter: `(${config.scopes.locations.attributes.id}=${id})`,
    };
    const options = { method: 'GET', headers };
    const query = buildQuery(params);
    fetch(`/ldap/${query}`, options)
      .then(processStatus)
      .then(response => response.json())
      .then(result => this.setState({ location: result[0], error: undefined }))
      .catch(error => this.setState({ location: {}, error }));
  }
github grommet / grommet-people-finder / src / js / components / PersonGroups.js View on Github external
getGroups(props) {
    this.setState({ groups: [], busy: true });
    if (props.person.dn) {
      this.setState({ busy: true });
      const filter =
        `(&(objectClass=${config.scopes.groups.attributes.objectClass})` +
        `(member=${props.person.dn}))`;
      const params = {
        url: config.ldapBaseUrl,
        base: `ou=${this.state.scope.ou},o=${config.organization}`,
        scope: 'sub',
        filter,
        attributes: attributesToArray(this.state.scope.attributes),
      };
      const options = { method: 'GET', headers };
      const query = buildQuery(params);
      fetch(`/ldap/${query}`, options)
        .then(processStatus)
        .then(response => response.json())
        .then(this.onGroupsResponse)
        .catch(error => this.setState({ groups: [], error, busy: false }));
    }
  }
github grommet / grommet-people-finder / src / js / components / Group.js View on Github external
getGroup(id) {
    const params = {
      url: config.ldapBaseUrl,
      base: `ou=${this.state.scope.ou},o=${config.organization}`,
      scope: 'sub',
      filter: `(${config.scopes.groups.attributes.id}=${id})`,
    };
    const options = { method: 'GET', headers };
    const query = buildQuery(params);
    fetch(`/ldap/${query}`, options)
      .then(processStatus)
      .then(response => response.json())
      .then(this.onGroupResponse)
      .catch(error => this.setState({ group: {}, error }));
  }
github grommet / grommet-people-finder / src / js / components / Organization.js View on Github external
getManager(managerDn) {
    const params = {
      url: config.ldapBaseUrl,
      base: managerDn,
      scope: 'sub',
    };
    const options = { method: 'GET', headers };
    const query = buildQuery(params);
    fetch(`/ldap/${query}`, options)
      .then(processStatus)
      .then(response => response.json())
      .then(this.onManagerResponse)
      .catch(error => this.setState({ staff: [], error }));
  }
github grommet / grommet-ferret / src / js / actions / Api.js View on Github external
export function watchAggregate (name, params, successHandler, errorHandler) {
  stopWatching(name, true);
  const query = buildQuery(params);
  const uri = `/rest/index/resources/aggregated${query}`;
  const watcher = watch(uri,
    (result) => normalizeAggregate(result, successHandler),
    errorHandler);
  watches[name] = watcher;
}
github grommet / grommet-people-finder / src / js / components / Person.js View on Github external
getPerson(id) {
    const params = {
      url: config.ldapBaseUrl,
      base: `ou=${this.state.scope.ou},o=${config.organization}`,
      scope: 'sub',
      filter: `(${config.scopes.people.attributes.id}=${id})`,
    };
    const options = { method: 'GET', headers };
    const query = buildQuery(params);
    fetch(`/ldap/${query}`, options)
      .then(processStatus)
      .then(response => response.json())
      .then(this.onPersonResponse)
      .catch(error => this.setState({ person: {}, error }));
  }
github grommet / grommet-people-finder / src / js / components / Details.js View on Github external
getAssistant(assistantDn) {
    const params = {
      url: config.ldapBaseUrl,
      base: assistantDn,
      scope: 'sub',
    };
    const options = { method: 'GET', headers };
    const query = buildQuery(params);
    fetch(`/ldap/${query}`, options)
      .then(processStatus)
      .then(response => response.json())
      .then(result => this.setState({ assistant: result[0], error: undefined }))
      .catch(error => this.setState({ assistant: {}, error }));
  }