Commit f1f23084 authored by hewenhao's avatar hewenhao

feat: update

parent 903ef57d
import { View, RootPortal, Image, Text } from '@tarojs/components' import { View, RootPortal, Image, Text } from '@tarojs/components'
import { useCallback, useEffect } from 'react' import { useCallback, useEffect, useRef } from 'react'
import classNames from 'classnames' import classNames from 'classnames'
import { useStoreState, useStoreActions } from '@/store/hooks' import { useStoreState, useStoreActions } from '@/store/hooks'
...@@ -15,6 +15,7 @@ const ModalContinue = () => { ...@@ -15,6 +15,7 @@ const ModalContinue = () => {
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount) const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const submit = useStoreActions(actions => actions.gameModel.submit) const submit = useStoreActions(actions => actions.gameModel.submit)
const reborn = useStoreActions(actions => actions.gameModel.reborn) const reborn = useStoreActions(actions => actions.gameModel.reborn)
const isClickRef = useRef(false)
useEffect(() => { useEffect(() => {
if (modalContinueVisible) { if (modalContinueVisible) {
...@@ -22,8 +23,14 @@ const ModalContinue = () => { ...@@ -22,8 +23,14 @@ const ModalContinue = () => {
} }
}, [fetchAccount, modalContinueVisible]) }, [fetchAccount, modalContinueVisible])
const handleReborn = useCallback(() => { const handleReborn = useCallback(async () => {
reborn() if (isClickRef.current) return
isClickRef.current = true
try {
await reborn()
} finally {
isClickRef.current = false
}
}, [reborn]) }, [reborn])
return ( return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment