How to use the @vssue/utils.buildURL function in @vssue/utils

To help you get started, we’ve selected a few @vssue/utils 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 meteorlxy / vssue / packages / @vssue / api-coding / src / index.ts View on Github external
async getAccessToken ({
    code,
  }: {
    code: string
  }): Promise {
    const originalURL = buildURL(concatURL(this.baseURL, 'api/oauth/access_token'), {
      client_id: this.clientId,
      client_secret: this.clientSecret,
      grant_type: 'authorization_code',
      code,
    })
    const proxyURL = typeof this.proxy === 'function'
      ? this.proxy(originalURL)
      : this.proxy
    const { data } = await this.$http.post(proxyURL)
    return data.access_token
  }
github meteorlxy / vssue / packages / @vssue / api-coding / src / index.ts View on Github external
redirectAuth (): void {
    window.location.href = buildURL(concatURL(this.baseURL, 'oauth_authorize.html'), {
      client_id: this.clientId,
      redirect_uri: window.location.href,
      response_type: 'code',
    })
  }
github meteorlxy / vssue / packages / @vssue / api-github-v4 / src / index.ts View on Github external
async handleAuth (): Promise {
    const query = parseQuery(window.location.search)
    if (query.code) {
      if (query.state !== this.state) {
        return null
      }
      const code = query.code
      delete query.code
      delete query.state
      const replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash
      window.history.replaceState(null, '', replaceURL)
      const accessToken = await this.getAccessToken({ code })
      return accessToken
    }
    return null
  }
github meteorlxy / vssue / packages / @vssue / api-github-v3 / lib / index.js View on Github external
GithubV3.prototype.redirectAuthorize = function () {
        window.location.href = buildURL('https://github.com/login/oauth/authorize', {
            client_id: this.clientId,
            redirect_uri: window.location.href,
            scope: 'public_repo',
            state: this.state,
        });
    };
    GithubV3.prototype.handleAuthorize = function () {
github meteorlxy / vssue / packages / @vssue / api-gitea-v1 / src / index.ts View on Github external
redirectAuth (): void {
    window.location.href = buildURL(concatURL(this.baseURL, 'login/oauth/authorize'), {
      client_id: this.clientId,
      redirect_uri: window.location.href,
      response_type: 'code',
      state: this.state,
    })
  }
github meteorlxy / vssue / packages / @vssue / api-github-v4 / src / index.ts View on Github external
redirectAuth (): void {
    window.location.href = buildURL(concatURL(this.baseURL, 'login/oauth/authorize'), {
      client_id: this.clientId,
      redirect_uri: window.location.href,
      scope: 'public_repo',
      state: this.state,
    })
  }
github meteorlxy / vssue / packages / @vssue / api-bitbucket-v2 / lib / index.js View on Github external
BitbucketV2.prototype.redirectAuthorize = function () {
        window.location.href = buildURL('https://bitbucket.org/site/oauth2/authorize', {
            client_id: this.clientId,
            redirect_uri: window.location.href,
            response_type: 'code',
        });
    };
    BitbucketV2.prototype.handleAuthorize = function () {