[fix] errors with default empty steam users + loading process

This commit is contained in:
Purp1e
2025-03-23 02:27:21 +08:00
parent 2247640dc1
commit 7e2e556485
8 changed files with 27 additions and 30 deletions

View File

@@ -12,16 +12,7 @@ const defaultValue = {
cs2DirValid: false,
steamDirChecking: false,
cs2DirChecking: false,
users: [
{
steamID64: "76561198052315353",
steamID32: "46157676",
accountName: "wrr_account",
personaName: "wrr",
recent: 0,
avatar: "",
},
] as SteamUser[],
users: [] as SteamUser[],
}
export const steamStore = store(
@@ -51,7 +42,7 @@ export const useSteamStore = () => {
}
const cs2BaseDir = () => {
return path.normalize(`${steamStore.state.cs2Dir.replaceAll("\\", "/") }/../../..`)
return path.normalize(`${steamStore.state.cs2Dir.replaceAll("\\", "/")}/../../..`)
}
const setDir = (dir: string) => {
@@ -97,7 +88,7 @@ const checkCs2DirValid = async () => {
}
const currentUser = () => {
return steamStore.state.users[0] || defaultValue.users[0]
return steamStore.state.users.at(0) || undefined
}
const resetSteamStore = () => {