Skip to content

Commit

Permalink
clear authstate on sign out
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Jul 6, 2024
1 parent 8b93a74 commit baab274
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"scripts": {
"dev": "vite --config vite.dev.config.ts",
"local": "VITE_APP_API_URL=http://localhost:8787/graphql vite --config vite.dev.config.ts",
"prod": "VITE_APP_API_URL=https://api.fluentci.io/graphql vite --config vite.dev.config.ts",
"prod": "VITE_APP_API_URL=https://api.fluentci.io/graphql VITE_CLERK_PUBLISHABLE_KEY=pk_live_Y2xlcmsuZmx1ZW50Y2kuaW8k vite --config vite.dev.config.ts",
"start": "electron .",
"build:web": "vite build --config vite.dev.config.ts",
"build": "tsc && vite build && electron-builder",
"build:prod": "VITE_APP_API_URL=https://api.fluentci.io/graphql tsc && vite build --config vite.dev.config.ts",
"build:prod": "VITE_APP_API_URL=https://api.fluentci.io/graphql VITE_CLERK_PUBLISHABLE_KEY=pk_live_Y2xlcmsuZmx1ZW50Y2kuaW8k tsc && vite build --config vite.dev.config.ts",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
Expand Down
1 change: 1 addition & 0 deletions webui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const router = createRouter([
path: "/auth",
element: <Auth />,
},

{
path: "/auth/sso-callback",
element: <AuthenticateWithRedirectCallback />,
Expand Down
4 changes: 3 additions & 1 deletion webui/src/Components/Navbar/NavbarWithData.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { FC, useEffect } from "react";
import Navbar from "./Navbar";
import { useNavigate } from "react-router-dom";
import { useRecoilValue } from "recoil";
import { useRecoilState, useRecoilValue } from "recoil";
import { AuthState } from "../../Containers/Auth/AuthState";
import { useAuth, useUser } from "@clerk/clerk-react";

const NavbarWithData: FC = () => {
const { getToken, isSignedIn, signOut } = useAuth();
const setMe = useRecoilState(AuthState)[1];
const { user } = useUser();
const me = useRecoilValue(AuthState);
const navigate = useNavigate();
Expand All @@ -15,6 +16,7 @@ const NavbarWithData: FC = () => {
await signOut();
localStorage.setItem("logout", "true");
localStorage.removeItem("token");
setMe(null);
};

useEffect(() => {
Expand Down

0 comments on commit baab274

Please sign in to comment.