初始化fateverse

This commit is contained in:
wenhua
2023-10-13 16:23:20 +08:00
commit 6f0949e432
47 changed files with 8371 additions and 0 deletions

27
src/stores/cache.ts Normal file
View File

@@ -0,0 +1,27 @@
import { createSlice } from '@reduxjs/toolkit'
type CacheKey = string
type CacheVal = any
const initCache = new Map<CacheKey, CacheVal>([])
// 创建一个slice
export const cacheSlice = createSlice({
name: 'cache',
// 初始化数据状态
initialState: {},
// 定义改变数据状态的方法
reducers: {
addCache(state, { payload }) {
state = {...state, ...payload}
return state
}
}
})
export const { addCache } = cacheSlice.actions
export default cacheSlice.reducer