feat : add redux
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
export const isAuthenticated = () => {
|
||||
return false;
|
||||
import { useSelector } from "react-redux";
|
||||
import { RootState } from "../redux/store";
|
||||
|
||||
const isTokenValid = (token: string): boolean => {
|
||||
try {
|
||||
if (!token) return false;
|
||||
|
||||
return !!token;
|
||||
} catch (error) {
|
||||
console.error("Token validation error:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const isAuthenticated = () : boolean => {
|
||||
const {token} = useSelector((state : RootState) => state.token)
|
||||
return isTokenValid(token);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user