This commit is contained in:
Tben 2023-06-24 14:28:36 +01:00
parent 5375a39e1a
commit 3949bf7cc1
2 changed files with 39 additions and 28 deletions

View File

@ -19,12 +19,15 @@ const parseClientCookies = require("../utils/parseClientCookies");
* *
* @async * @async
* *
* @param {object} params - Single object passed
* @param {string|null} params.googleClientId - Google client Id if applicable
*
* @requires localStorageUser - a "user" JSON string stored in local storage with all * @requires localStorageUser - a "user" JSON string stored in local storage with all
* the necessary user data gotten from the server * the necessary user data gotten from the server
* *
* @returns {Promise<boolean>} - Return * @returns {Promise<boolean>} - Return
*/ */
module.exports = async function logout() { module.exports = async function logout(params) {
/** /**
* == Initialize * == Initialize
* *
@ -73,6 +76,9 @@ module.exports = async function logout() {
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
if (socialId) { if (socialId) {
const googleClientId = params.googleClientId;
if (googleClientId) {
const googleScript = document.createElement("script"); const googleScript = document.createElement("script");
googleScript.src = "https://accounts.google.com/gsi/client"; googleScript.src = "https://accounts.google.com/gsi/client";
googleScript.className = "social-script-tag"; googleScript.className = "social-script-tag";
@ -90,7 +96,7 @@ module.exports = async function logout() {
//////////////////////////////////////// ////////////////////////////////////////
google.accounts.id.initialize({ google.accounts.id.initialize({
client_id: clientId, client_id: googleClientId,
}); });
google.accounts.id.revoke(socialId, (done) => { google.accounts.id.revoke(socialId, (done) => {
@ -104,6 +110,11 @@ module.exports = async function logout() {
//////////////////////////////////////// ////////////////////////////////////////
} }
}; };
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} else { } else {
resolve(true); resolve(true);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.1.47", "version": "1.1.48",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {