How to use the @vssue/utils.parseQuery 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-gitea-v1 / 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-gitee-v5 / 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-gitlab-v4 / src / index.ts View on Github external
async handleAuth (): Promise {
    const hash = parseQuery(window.location.hash.slice(1))
    if (!hash.access_token || hash.state !== this.state) {
      return null
    }
    const accessToken = hash.access_token
    delete hash.access_token
    delete hash.token_type
    delete hash.expires_in
    delete hash.state
    const hashString = buildQuery(hash)
    const newHash = hashString ? `#${hashString}` : ''
    const replaceURL = `${getCleanURL(window.location.href)}${window.location.search}${newHash}`
    window.history.replaceState(null, '', replaceURL)
    return accessToken
  }
github meteorlxy / vssue / packages / @vssue / api-gitlab-v4 / lib / index.js View on Github external
return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        query = parseQuery(window.location.search);
                        if (!query.code) return [3 /*break*/, 2];
                        if (query.state !== this.state) {
                            return [2 /*return*/, null];
                        }
                        code = query.code;
                        delete query.code;
                        delete query.state;
                        replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
                        window.history.replaceState(null, '', replaceURL);
                        return [4 /*yield*/, this.getAccessToken({ code: code })];
                    case 1:
                        accessToken = _a.sent();
                        return [2 /*return*/, accessToken];
                    case 2: return [2 /*return*/, null];
                }
            });
github meteorlxy / vssue / packages / @vssue / api-coding / src / index.ts View on Github external
async handleAuth (): Promise {
    const query = parseQuery(window.location.search)
    if (query.code) {
      const code = query.code
      delete query.code
      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
return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        query = parseQuery(window.location.search);
                        if (!query.code) return [3 /*break*/, 2];
                        if (query.state !== this.state) {
                            return [2 /*return*/, null];
                        }
                        code = query.code;
                        delete query.code;
                        delete query.state;
                        replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
                        window.history.replaceState(null, '', replaceURL);
                        return [4 /*yield*/, this.getAccessToken({ code: code })];
                    case 1:
                        accessToken = _a.sent();
                        return [2 /*return*/, accessToken];
                    case 2: return [2 /*return*/, null];
                }
            });
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-bitbucket-v2 / lib / index.js View on Github external
return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        query = parseQuery(window.location.search);
                        if (!query.code) return [3 /*break*/, 2];
                        code = query.code;
                        delete query.code;
                        replaceURL = buildURL(getCleanURL(window.location.href), query) + window.location.hash;
                        window.history.replaceState(null, '', replaceURL);
                        return [4 /*yield*/, this.getAccessToken({ code: code })];
                    case 1:
                        accessToken = _a.sent();
                        return [2 /*return*/, accessToken];
                    case 2: return [2 /*return*/, null];
                }
            });
        });
github meteorlxy / vssue / packages / @vssue / api-bitbucket-v2 / src / index.ts View on Github external
async handleAuth (): Promise {
    const hash = parseQuery(window.location.hash.slice(1))
    if (!hash.access_token || hash.state !== this.state) {
      return null
    }
    const accessToken = hash.access_token
    delete hash.access_token
    delete hash.token_type
    delete hash.expires_in
    delete hash.state
    delete hash.scopes
    const hashString = buildQuery(hash)
    const newHash = hashString ? `#${hashString}` : ''
    const replaceURL = `${getCleanURL(window.location.href)}${window.location.search}${newHash}`
    window.history.replaceState(null, '', replaceURL)
    return accessToken
  }
github meteorlxy / vssue / packages / @vssue / api-github-v3 / 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
  }