UNPKG

create-nova-vite-template

Version:

This is a dashboard template built with React and Vite. It provides a modern and responsive user interface for building web applications.

17 lines (14 loc) 424 B
import { useEffect } from "react"; import { useDispatch } from "react-redux"; import { login } from "@/reducers/authReducer"; export default function useCheckAuthTokenExistance() { const dispatch = useDispatch(); useEffect(() => { (async () => { const userToken = localStorage.getItem("token"); if (userToken) { dispatch(login(userToken)); } })(); }, [dispatch]); }