Skip to content

Commit

Permalink
fix : logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid-80 committed Jul 10, 2024
1 parent d7f5224 commit f7142ae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import axiosProtectedInstance from "@/config/AxiosProtectedRoute";
import { checkHealthUrl } from "@/lib/API-URLs";
import createAxiosInstance from "@/config/AxiosProtectedRoute";
import { useRouter } from "next/navigation";
import { logOut } from "../Redux/Auth/auth-slice";

export interface FILE {
archive: boolean;
Expand Down Expand Up @@ -52,7 +53,10 @@ function Dashboard() {
useEffect(() => {
const checkHealth = async () => {
const res = await axiosInstance.get(checkHealthUrl);
if(res.status !== 200) router.push('/signin');
if(res.status !== 200) {
router.push('/signin');
dispatch(logOut())
};
};
checkHealth();
}, []);
Expand Down

0 comments on commit f7142ae

Please sign in to comment.