This commit is contained in:
Benjamin Toby
2025-01-10 20:35:05 +01:00
parent 9192dae0b5
commit a3561da53d
286 changed files with 13862 additions and 42590 deletions
+13
View File
@@ -0,0 +1,13 @@
type Param = {
clientId: string;
redirectUrl: string;
setLoading?: (arg0: boolean) => void;
scopes?: string[];
};
/**
* Login with Github Function
* ===============================================================================
* @description This function uses github api to login a user with datasquirel
*/
export default function getAccessToken({ clientId, redirectUrl, setLoading, scopes, }: Param): void;
export {};
+15
View File
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getAccessToken;
/**
* Login with Github Function
* ===============================================================================
* @description This function uses github api to login a user with datasquirel
*/
function getAccessToken({ clientId, redirectUrl, setLoading, scopes, }) {
if (setLoading)
setLoading(true);
const scopeString = scopes ? scopes.join("%20") : "read:user";
const fetchUrl = `https://github.com/login/oauth/authorize?client_id=${clientId}&scope=${scopeString}&redirect_uri=${redirectUrl}`;
window.location.assign(fetchUrl);
}