import { useEffect } from "react";
import { useLocation } from "react-router-dom";

export default function PageChangeHandler() {
  const { pathname } = useLocation();

  useEffect(() => {
    loginAccountCheck();
  }, [pathname]);

  const loginAccountCheck = () => {
    let acc = pathname.split('/')[1];
    if(localStorage.getItem('kiki_acc_type') && (acc != localStorage.getItem('kiki_acc_type'))) {
      location.reload();
    }
  }

  return null;
}
