import { Role } from '@/constants';
import { Button } from 'antd';
import { PageContainer } from '@ant-design/pro-components';
import { useState } from 'react';
export default function Page() {
  const [power,serpower] = useState('');
  let tokens = sessionStorage.getItem('token');
  const changePower = ()=>{ 
        sessionStorage.setItem('token',(tokens==Role.admin?Role.member:Role.admin));
        serpower(tokens)
        location.reload(); 
  }
  useState(()=>{
    serpower(tokens)
  },[])
  return (
    <PageContainer>
      <h1 className={`text-lg text-slate-600`}>首页页面</h1> 
      <Button type="dashed" onClick={(e) => changePower(e)}>{power==Role.admin?'切换普通权限':'切换管理员权限'}</Button>
    </PageContainer>
  );
}
