How to use the query-string.stringifyUrl function in query-string

To help you get started, we’ve selected a few query-string 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 gojek / mlp / ui / packages / lib / src / hooks / useApi.js View on Github external
options => {
      let didCancel = false;

      const apiOptions = !!options
        ? {
            ...args.options,
            ...options
          }
        : args.options;

      dispatch({ type: "FETCH_INIT" });
      (apiOptions.useMockData && apiOptions.mock
        ? fetchMockData(apiOptions.mock, apiOptions)
        : fetchJson(
            queryString.stringifyUrl({
              url: urlJoin(apiOptions.baseApiUrl, endpoint),
              // query params supplied via `apiOptions` have a higher priority
              // and will override query param with the same name if it is
              // present in the `endpoint`
              query: apiOptions.query
            }),
            args.authCtx,
            apiOptions
          )
      )
        .then(result => {
          if (!didCancel)
            dispatch({
              type: "FETCH_SUCCESS",
              payload: result.body,
              headers: result.headers
github navtrack / navtrack / Navtrack.Core / ClientApp / src / framework / httpClient / HttpClientUtil.ts View on Github external
export const formatUrl = (url: string, query?: any): string =>
  queryString.stringifyUrl({ url: url, query: query });

query-string

Parse and stringify URL query strings

MIT
Latest version published 4 months ago

Package Health Score

87 / 100
Full package analysis