[feat] global watch dir and set better check logic
todo: first time check failed should let user manually click
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
"use client"
|
||||
import { steamStore } from "@/store/steam"
|
||||
import { steamStore, useSteamStore } from "@/store/steam"
|
||||
import { useEffect } from "react"
|
||||
import "./globals.css"
|
||||
import Providers from "./providers"
|
||||
import { init } from "@/store"
|
||||
import { useDebounce } from "@uidotdev/usehooks"
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
useEffect(() => {
|
||||
void init()
|
||||
})
|
||||
|
||||
// 检测steam路径和游戏路径是否有效
|
||||
const steam = useSteamStore()
|
||||
const debounceSteamDir = useDebounce(steam.state.steamDir, 500)
|
||||
const debounceCs2Dir = useDebounce(steam.state.cs2Dir, 500)
|
||||
useEffect(() => {
|
||||
steam.checkSteamDirValid()
|
||||
}, [debounceSteamDir])
|
||||
useEffect(() => {
|
||||
steam.checkCs2DirValid()
|
||||
}, [debounceCs2Dir])
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user