Commit f1f23084 authored by hewenhao's avatar hewenhao

feat: update

parent 903ef57d
import { View, RootPortal, Image, Text } from '@tarojs/components'
import { useCallback, useEffect } from 'react'
import { useCallback, useEffect, useRef } from 'react'
import classNames from 'classnames'
import { useStoreState, useStoreActions } from '@/store/hooks'
......@@ -15,6 +15,7 @@ const ModalContinue = () => {
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const submit = useStoreActions(actions => actions.gameModel.submit)
const reborn = useStoreActions(actions => actions.gameModel.reborn)
const isClickRef = useRef(false)
useEffect(() => {
if (modalContinueVisible) {
......@@ -22,8 +23,14 @@ const ModalContinue = () => {
}
}, [fetchAccount, modalContinueVisible])
const handleReborn = useCallback(() => {
reborn()
const handleReborn = useCallback(async () => {
if (isClickRef.current) return
isClickRef.current = true
try {
await reborn()
} finally {
isClickRef.current = false
}
}, [reborn])
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