import type { NextPage } from 'next';
import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/router'
import { useSelector } from 'react-redux';
import { MainLayoutRoot } from '../../components/admin/pages/Root/Main'
import { Login } from './login';

import { selectTokenData } from '../../redux/login/selectors';

const Admin: NextPage = () => {
  const router = useRouter();
  const { token } = useSelector(selectTokenData);

  useEffect(() => {
    localStorage.getItem("token") ? router.push('/admin/main'): router.push('/admin/login');
  }, [localStorage.getItem("token")]);

  return (
       <>...</>
  )
}

export default Admin;
