Bugfixes
This commit is contained in:
parent
0db63a39bb
commit
c6dba61007
@ -12,11 +12,11 @@
|
|||||||
* @param {string} params.redirectUrl - Github Redirect URL as listed in your oauth app settings: {@link https://datasquirel.com/docs}
|
* @param {string} params.redirectUrl - Github Redirect URL as listed in your oauth app settings: {@link https://datasquirel.com/docs}
|
||||||
* @param {function(boolean): void} [params.setLoading] - React setState Function: sets whether the google login button is ready or not
|
* @param {function(boolean): void} [params.setLoading] - React setState Function: sets whether the google login button is ready or not
|
||||||
* @param {string[]} [params.scopes] - Scopes to be requested from the user
|
* @param {string[]} [params.scopes] - Scopes to be requested from the user
|
||||||
* @param {{key: string, value: string}[]} [params.extraParams] - Extra params to be added to the url
|
* @param {{key: string, value: string}[] | string} [params.extraUriParams] - Extra params to be added to the url
|
||||||
*
|
*
|
||||||
* @returns {void} - Return
|
* @returns {void} - Return
|
||||||
*/
|
*/
|
||||||
module.exports = function getAccessToken({ clientId, redirectUrl, setLoading, scopes, extraParams }) {
|
module.exports = function getAccessToken({ clientId, redirectUrl, setLoading, scopes, extraUriParams }) {
|
||||||
/**
|
/**
|
||||||
* == Initialize
|
* == Initialize
|
||||||
*
|
*
|
||||||
@ -26,13 +26,15 @@ module.exports = function getAccessToken({ clientId, redirectUrl, setLoading, sc
|
|||||||
|
|
||||||
const scopeString = scopes ? scopes.join("%20") : "user";
|
const scopeString = scopes ? scopes.join("%20") : "user";
|
||||||
|
|
||||||
const extraParamsString = extraParams
|
const extraUriParamsString = extraUriParams
|
||||||
? `&${Object.keys(extraParams)
|
? typeof extraUriParams == "string"
|
||||||
.map((key) => `${key}=${extraParams[key]}`)
|
? extraUriParams
|
||||||
|
: `?${Object.keys(extraUriParams)
|
||||||
|
.map((key) => `${key}=${extraUriParams[key]}`)
|
||||||
.join("&")}`
|
.join("&")}`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
const fetchUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=${scopeString}&redirect_uri=${redirectUrl}${window.location.pathname}${extraParamsString}`;
|
const fetchUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=${scopeString}&redirect_uri=${redirectUrl}${window.location.pathname}${extraUriParamsString}`;
|
||||||
window.location.assign(fetchUrl);
|
window.location.assign(fetchUrl);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.3.4",
|
"version": "1.3.5",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user