Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TsumikiQAQ committed Feb 1, 2024
1 parent b7acf62 commit e85cde8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/lib/components/loading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ProgressBar } from "react-bootstrap";
import { useRouter } from "../../hooks/router";
import { version } from "../../api/interface";
const Loadingpage = () =>{
const router = useRouter()
const [loading,setLoading] = useState(0)
const [ver,setVer] = useState({})
const [isFirstVisit, setIsFirstVisit] = useState(true);
Expand All @@ -13,9 +12,6 @@ const Loadingpage = () =>{
setVer(response.data)
return response
}
const to = ()=>{
router.push('/repository')
}
useEffect(() => {
if (localStorage.getItem('hasVisited')) {
setIsFirstVisit(false)
Expand All @@ -26,17 +22,13 @@ const Loadingpage = () =>{
getversion()
},[])
useEffect(()=>{
if(loading >= 100){
if(loading == 100){
localStorage.setItem('hasVisited','true')
setIsFirstVisit(false)
setTimeout(()=>{
to()
},1000)
}else if(loading<100){
let randomNum = Math.floor(Math.random() * (5)) + 1;
setTimeout(()=>{
setLoading((loading+randomNum)>100 ? 100 :loading+randomNum)
},1000)
},500)
}
},[loading])
if (!isFirstVisit) {
Expand Down

0 comments on commit e85cde8

Please sign in to comment.