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

adding cookie in access token #1301

Merged
merged 5 commits into from
Oct 3, 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
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