const ParseJwt = (token) => {
  // const router = useRouter();

  try {
    if (!token) {
      return;
    }
    const base64Url = token.split(".")[1];
    const base64 = base64Url.replace("-", "+").replace("_", "/");

    return JSON.parse(window.atob(base64));
  } catch (error) {
    localStorage.removeItem("token");
    window.location.reload("/login");
  }
};

export default ParseJwt;
