Skip to content

Commit

Permalink
adding cookie in access token (TransformerOptimus#1302)
Browse files Browse the repository at this point in the history
* adding cookie in access token

* adding cookie in access token

* adding cookie in access token
  • Loading branch information
namansleeps authored Oct 3, 2023
1 parent 0a24481 commit a5001f6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions gui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"echarts-for-react": "^3.0.2",
"eslint": "8.40.0",
"eslint-config-next": "13.4.2",
"js-cookie": "^3.0.5",
"jszip": "^3.10.1",
"mitt": "^3.0.0",
"mixpanel-browser": "^2.47.0",
Expand Down
2 changes: 2 additions & 0 deletions gui/pages/Dashboard/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {useRouter} from 'next/router';
import {ToastContainer, toast} from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import {refreshUrl, openNewTab, getUserClick} from "@/utils/utils";
import Cookies from 'js-cookie';

export default function TopBar({selectedProject, userName, env}) {
const [dropdown, setDropdown] = useState(false);
Expand All @@ -18,6 +19,7 @@ export default function TopBar({selectedProject, userName, env}) {
}
getUserClick('Logged Out',{})
localStorage.removeItem('accessToken');
Cookies.remove('accessToken');
refreshUrl();
router.reload();
};
Expand Down
4 changes: 3 additions & 1 deletion gui/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {refreshUrl, loadingTextEffect, getUTMParametersFromURL, setLocalStorageV
import MarketplacePublic from "./Content/Marketplace/MarketplacePublic"
import {toast} from "react-toastify";
import mixpanel from 'mixpanel-browser';

import Cookies from 'js-cookie';

export default function App() {
const [selectedView, setSelectedView] = useState('');
Expand Down Expand Up @@ -152,6 +152,7 @@ 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 All @@ -164,6 +165,7 @@ export default function App() {
.catch((error) => {
console.error('Error fetching project:', error);
});

}, []);

useEffect(() => {
Expand Down

0 comments on commit a5001f6

Please sign in to comment.