From 5c4ab4926edc9fe5da60b126039eeab427c2c3ca Mon Sep 17 00:00:00 2001 From: namansleeps Date: Tue, 10 Oct 2023 15:36:49 +0530 Subject: [PATCH] removing logout changes --- gui/pages/Dashboard/TopBar.js | 4 ++-- gui/pages/_app.js | 7 ++----- gui/pages/api/apiConfig.js | 6 ++---- gui/utils/utils.js | 1 - 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/gui/pages/Dashboard/TopBar.js b/gui/pages/Dashboard/TopBar.js index ad1b6592b..fbd232dc4 100644 --- a/gui/pages/Dashboard/TopBar.js +++ b/gui/pages/Dashboard/TopBar.js @@ -21,8 +21,8 @@ export default function TopBar({selectedProject, userName, env}) { return; } getUserClick('Logged Out',{}) - // localStorage.removeItem('accessToken'); - Cookies.set('accessToken', '', { expires: new Date(0)}); + localStorage.removeItem('accessToken'); + Cookies.set('accessToken', '', { expires: new Date(0), domain: '.superagi.com', path: '/' }); refreshUrl(); router.reload(); }; diff --git a/gui/pages/_app.js b/gui/pages/_app.js index adc90c87d..126c9f247 100644 --- a/gui/pages/_app.js +++ b/gui/pages/_app.js @@ -135,10 +135,7 @@ export default function App() { const singupCampaign = sessionStorage.getItem('campaign'); if (typeof window !== 'undefined' && access_token) { - // localStorage.setItem('accessToken', access_token); - console.log(access_token+'///') - Cookies.set('accessToken', access_token); - console.log(Cookies.get('accessToken')+'khikhikhhi') + localStorage.setItem('accessToken', access_token); refreshUrl(); } validateAccessToken() @@ -155,7 +152,7 @@ export default function App() { if(signupSource) { handleSignUpSource(signupSource) } - // Cookies.set('accessToken', localStorage.getItem('accessToken'),{ domain: '.superagi.com', path: '/' }); + Cookies.set('accessToken', localStorage.getItem('accessToken'),{ domain: '.superagi.com', path: '/' }); fetchOrganisation(response.data.id); }) .catch((error) => { diff --git a/gui/pages/api/apiConfig.js b/gui/pages/api/apiConfig.js index 6e65bfeea..14da159c4 100644 --- a/gui/pages/api/apiConfig.js +++ b/gui/pages/api/apiConfig.js @@ -1,7 +1,6 @@ import axios from 'axios'; -import Cookies from "js-cookie"; -const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID || 'eaaf029abe1165e23c1e'; +const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID; const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8001'; const GOOGLE_ANALYTICS_MEASUREMENT_ID = process.env.GOOGLE_ANALYTICS_MEASUREMENT_ID; const GOOGLE_ANALYTICS_API_SECRET = process.env.GOOGLE_ANALYTICS_API_SECRET; @@ -38,8 +37,7 @@ const api = axios.create({ api.interceptors.request.use(config => { if (typeof window !== 'undefined') { - const accessToken = Cookies.get("accessToken"); - console.log(accessToken +'hahahahahah') + const accessToken = localStorage.getItem("accessToken"); if (accessToken) { config.headers['Authorization'] = `Bearer ${accessToken}`; } diff --git a/gui/utils/utils.js b/gui/utils/utils.js index 9baa55925..c601e76d3 100644 --- a/gui/utils/utils.js +++ b/gui/utils/utils.js @@ -5,7 +5,6 @@ import {EventBus} from "@/utils/eventBus"; import JSZip from "jszip"; import moment from 'moment'; import mixpanel from 'mixpanel-browser' -import Cookies from "js-cookie"; const toolkitData = { 'Jira Toolkit': '/images/jira_icon.svg',