Skip to content

Commit

Permalink
adding cookie in access token (#1301)
Browse files Browse the repository at this point in the history
  • Loading branch information
namansleeps authored Oct 3, 2023
1 parent c46765d commit 9720c65
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
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
3 changes: 3 additions & 0 deletions gui/pages/Dashboard/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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 +20,7 @@ export default function TopBar({selectedProject, userName, env}) {
}
getUserClick('Logged Out',{})
localStorage.removeItem('accessToken');
Cookies.remove('accessToken');
refreshUrl();
router.reload();
};
Expand Down
3 changes: 3 additions & 0 deletions gui/pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +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() {
Expand Down Expand Up @@ -61,6 +62,7 @@ export default function App() {
});
}


const installFromMarketplace = () => {
const toolkitName = localStorage.getItem('toolkit_to_install') || null;
const agentTemplateId = localStorage.getItem('agent_to_install') || null;
Expand Down Expand Up @@ -152,6 +154,7 @@ export default function App() {
if(signupSource) {
handleSignUpSource(signupSource)
}
Cookies.set('accessToken', access_token, { domain: '.superagi.com', path: '/' });
fetchOrganisation(response.data.id);
})
.catch((error) => {
Expand Down

0 comments on commit 9720c65

Please sign in to comment.