Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logout bug complete #1332

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gui/pages/Dashboard/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default function TopBar({selectedProject, userName, env}) {
return;
}
getUserClick('Logged Out',{})
localStorage.removeItem('accessToken');
Cookies.set('accessToken', '', { expires: new Date(0), domain: '.superagi.com', path: '/' });
// localStorage.removeItem('accessToken');
Cookies.set('accessToken', '', { expires: new Date(0),domain: '.superagi.com', path: '/'});
Cookies.set('Source', 'app.superagi', {domain: '.superagi.com', path: '/'});
refreshUrl();
router.reload();
};
Expand Down
4 changes: 2 additions & 2 deletions gui/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ export default function App() {
const singupCampaign = sessionStorage.getItem('campaign');

if (typeof window !== 'undefined' && access_token) {
localStorage.setItem('accessToken', access_token);
// localStorage.setItem('accessToken', access_token);
Cookies.set('accessToken', access_token, { domain: '.superagi.com', path: '/' });
refreshUrl();
}
validateAccessToken()
Expand All @@ -152,7 +153,6 @@ export default function App() {
if(signupSource) {
handleSignUpSource(signupSource)
}
Cookies.set('accessToken', localStorage.getItem('accessToken'),{ domain: '.superagi.com', path: '/' });
fetchOrganisation(response.data.id);
})
.catch((error) => {
Expand Down
4 changes: 3 additions & 1 deletion gui/pages/api/apiConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import Cookies from "js-cookie";

const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID;
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8001';
Expand Down Expand Up @@ -37,7 +38,8 @@ const api = axios.create({

api.interceptors.request.use(config => {
if (typeof window !== 'undefined') {
const accessToken = localStorage.getItem("accessToken");
// const accessToken = localStorage.getItem("accessToken");
const accessToken = Cookies.get("accessToken");
if (accessToken) {
config.headers['Authorization'] = `Bearer ${accessToken}`;
}
Expand Down
4 changes: 3 additions & 1 deletion gui/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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',
Expand Down Expand Up @@ -114,7 +115,8 @@ export const formatBytes = (bytes, decimals = 2) => {
};

export const downloadFile = (fileId, fileName = null) => {
const authToken = localStorage.getItem('accessToken');
// const authToken = localStorage.getItem('accessToken');
const authToken = Cookies.get("accessToken");
const url = `${baseUrl()}/resources/get/${fileId}`;
const env = localStorage.getItem('applicationEnvironment');

Expand Down
Loading