[dep] update to eslint 9
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { create } from 'zustand'
|
||||
import { tauriStore } from '@/utils/persist'
|
||||
import { createJSONStorage, persist } from 'zustand/middleware'
|
||||
import { tauriStore } from "@/utils/persist"
|
||||
import { create } from "zustand"
|
||||
import { createJSONStorage, persist } from "zustand/middleware"
|
||||
|
||||
interface AppState {
|
||||
version: string
|
||||
@@ -23,23 +23,25 @@ const { /* store, */ storage } = tauriStore(STORE_NAME)
|
||||
|
||||
const useAppStore = create<AppState & AppAction>()(
|
||||
persist(
|
||||
(set/* , get */) => ({
|
||||
(set /* , get */) => ({
|
||||
version: "0.0.1",
|
||||
hasUpdate: false,
|
||||
inited: false,
|
||||
notice: "Man! What can I say?",
|
||||
useMirror: true,
|
||||
setVersion: (version: string) => set(() => ({ version: version })),
|
||||
setHasUpdate: (hasUpdate: boolean) => set(() => ({ hasUpdate: hasUpdate })),
|
||||
setHasUpdate: (hasUpdate: boolean) =>
|
||||
set(() => ({ hasUpdate: hasUpdate })),
|
||||
setInited: (inited: boolean) => set(() => ({ inited: inited })),
|
||||
setNotice: (notice: string) => set(() => ({ notice: notice })),
|
||||
setUseMirror: (useMirror: boolean) => set(() => ({ useMirror: useMirror }))
|
||||
setUseMirror: (useMirror: boolean) =>
|
||||
set(() => ({ useMirror: useMirror })),
|
||||
}),
|
||||
{
|
||||
name: STORE_NAME, // name of item in the storage (must be unique)
|
||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
||||
},
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
export default useAppStore
|
||||
export default useAppStore
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SteamUser } from '@/types/steam'
|
||||
import { tauriStore } from '@/utils/persist'
|
||||
import { create } from 'zustand'
|
||||
import { persist, createJSONStorage } from 'zustand/middleware'
|
||||
import type { SteamUser } from "@/types/steam"
|
||||
import { tauriStore } from "@/utils/persist"
|
||||
import { create } from "zustand"
|
||||
import { createJSONStorage, persist } from "zustand/middleware"
|
||||
|
||||
const mock_user: SteamUser = {
|
||||
steamID64: "76561198052315353",
|
||||
@@ -14,20 +14,20 @@ const mock_user: SteamUser = {
|
||||
}
|
||||
|
||||
interface SteamState {
|
||||
dir: string,
|
||||
csDir: string,
|
||||
users: SteamUser[],
|
||||
isDirValid: boolean,
|
||||
isCsDirValid: boolean,
|
||||
dir: string
|
||||
csDir: string
|
||||
users: SteamUser[]
|
||||
isDirValid: boolean
|
||||
isCsDirValid: boolean
|
||||
}
|
||||
|
||||
interface SteamAction {
|
||||
setDir: (dir: string) => void,
|
||||
setCsDir: (dir: string) => void,
|
||||
setUsers: (users: SteamUser[]) => void,
|
||||
setIsDirValid: (valid: boolean) => void,
|
||||
setIsCsDirValid: (valid: boolean) => void,
|
||||
currentUser: () => SteamUser,
|
||||
setDir: (dir: string) => void
|
||||
setCsDir: (dir: string) => void
|
||||
setUsers: (users: SteamUser[]) => void
|
||||
setIsDirValid: (valid: boolean) => void
|
||||
setIsCsDirValid: (valid: boolean) => void
|
||||
currentUser: () => SteamUser
|
||||
}
|
||||
|
||||
const STORE_NAME = "steam"
|
||||
@@ -53,8 +53,8 @@ const useSteamStore = create<SteamState & SteamAction>()(
|
||||
{
|
||||
name: STORE_NAME, // name of item in the storage (must be unique)
|
||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
export default useSteamStore
|
||||
export default useSteamStore
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { tauriStore } from '@/utils/persist'
|
||||
import { create } from 'zustand'
|
||||
import { createJSONStorage, persist } from 'zustand/middleware'
|
||||
import { tauriStore } from "@/utils/persist"
|
||||
import { create } from "zustand"
|
||||
import { createJSONStorage, persist } from "zustand/middleware"
|
||||
|
||||
interface ToolState {
|
||||
launchOptions: string[]
|
||||
@@ -20,20 +20,32 @@ const { /* store, */ storage } = tauriStore(STORE_NAME)
|
||||
|
||||
const useToolStore = create<ToolState & ToolAction>()(
|
||||
persist(
|
||||
(set/* , get */) => ({
|
||||
launchOptions: ["-high -refresh 120 -novid -nojoy -tickrate 128 +cl_cmdrate 128 +cl_updaterate 128 +exec auto.cfg +test", "", ""],
|
||||
(set /* , get */) => ({
|
||||
launchOptions: [
|
||||
"-high -refresh 120 -novid -nojoy -tickrate 128 +cl_cmdrate 128 +cl_updaterate 128 +exec auto.cfg +test",
|
||||
"",
|
||||
"",
|
||||
],
|
||||
launchIndex: 0,
|
||||
powerPlan: 0,
|
||||
setLaunchOption: (option: string, index: number) => set((state) => ({ launchOptions: [...state.launchOptions.slice(0, index), option, ...state.launchOptions.slice(index + 1)] })),
|
||||
setLaunchOptions: (options: string[]) => set(() => ({ launchOptions: options })),
|
||||
setLaunchOption: (option: string, index: number) =>
|
||||
set((state) => ({
|
||||
launchOptions: [
|
||||
...state.launchOptions.slice(0, index),
|
||||
option,
|
||||
...state.launchOptions.slice(index + 1),
|
||||
],
|
||||
})),
|
||||
setLaunchOptions: (options: string[]) =>
|
||||
set(() => ({ launchOptions: options })),
|
||||
setLaunchIndex: (index: number) => set(() => ({ launchIndex: index })),
|
||||
setPowerPlan: (index: number) => set(() => ({ powerPlan: index }))
|
||||
setPowerPlan: (index: number) => set(() => ({ powerPlan: index })),
|
||||
}),
|
||||
{
|
||||
name: STORE_NAME, // name of item in the storage (must be unique)
|
||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
export default useToolStore
|
||||
export default useToolStore
|
||||
|
||||
Reference in New Issue
Block a user