|
@@ -3,23 +3,14 @@ import { FC, PropsWithChildren } from "react";
|
|
import { useRouter } from "@/i18n";
|
|
import { useRouter } from "@/i18n";
|
|
import clsx from "clsx";
|
|
import clsx from "clsx";
|
|
import ItemCom from "./component/ItemCom";
|
|
import ItemCom from "./component/ItemCom";
|
|
|
|
+import ModalCom from "./component/ModalCom";
|
|
import './page.scss'
|
|
import './page.scss'
|
|
import { useGlobalStore } from '@/stores';
|
|
import { useGlobalStore } from '@/stores';
|
|
-import {getLogoutApi} from "@/api/user";
|
|
|
|
|
|
|
|
interface Props {}
|
|
interface Props {}
|
|
|
|
|
|
const Profile: FC<PropsWithChildren<Props>> = () => {
|
|
const Profile: FC<PropsWithChildren<Props>> = () => {
|
|
- const { token, setToken, userInfo, setUserInfo } = useGlobalStore();
|
|
|
|
-
|
|
|
|
- const logoutRequest = async () => {
|
|
|
|
- let res = await getLogoutApi()
|
|
|
|
- if(res.code == 200) {
|
|
|
|
- setUserInfo('')
|
|
|
|
- setToken('')
|
|
|
|
- router.replace('/login')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ const { token, userInfo } = useGlobalStore();
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const goPage = (path = '/') => {
|
|
const goPage = (path = '/') => {
|
|
@@ -79,14 +70,8 @@ const Profile: FC<PropsWithChildren<Props>> = () => {
|
|
<span onClick={() => goPage('/deposit')}>Depósito</span>
|
|
<span onClick={() => goPage('/deposit')}>Depósito</span>
|
|
<span onClick={() => goPage(token ? '/withdraw' : `/login?redirect=withdraw`)}>Sacar</span>
|
|
<span onClick={() => goPage(token ? '/withdraw' : `/login?redirect=withdraw`)}>Sacar</span>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
<ItemCom />
|
|
<ItemCom />
|
|
-
|
|
|
|
- {
|
|
|
|
- token ? <span className="logOut" onClick={logoutRequest}>Sair</span> : (
|
|
|
|
- <span className="logOut" onClick={() => goPage('/login')}>Login</span>
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
|
|
+ <ModalCom />
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
};
|
|
};
|