Skip to content

Commit

Permalink
solved redirect after connect:
Browse files Browse the repository at this point in the history
  • Loading branch information
damienen committed Sep 14, 2023
1 parent de3eda0 commit f1d2628
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/components/AuthRedirectWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, { PropsWithChildren } from "react";
// import { Navigate } from "react-router-dom";
// import { useGetIsLoggedIn } from "hooks";
// import { routeNames } from "routes";
import { useNavigate } from "react-router-dom";
import { useGetIsLoggedIn } from "hooks";
import { routeNames } from "routes";

export const AuthRedirectWrapper = ({ children }: PropsWithChildren) => {
// const isLoggedIn = useGetIsLoggedIn();
const isLoggedIn = useGetIsLoggedIn();
const navigate = useNavigate();

// if (isLoggedIn) {
// return <Navigate to={routeNames.dashboard} />;
// }
if (isLoggedIn) {
navigate(routeNames.dashboard);
}

return <>{children}</>;
};

0 comments on commit f1d2628

Please sign in to comment.