feat: migrate state from v1 to v2

This commit is contained in:
Yidadaa
2023-04-27 02:00:22 +08:00
parent 401c1364be
commit 30040a0366
8 changed files with 85 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { StoreKey } from "../constant";
export interface AccessControlStore {
accessCode: string;
@@ -14,8 +15,6 @@ export interface AccessControlStore {
fetch: () => void;
}
export const ACCESS_KEY = "access-control";
let fetchState = 0; // 0 not fetch, 1 fetching, 2 done
export const useAccessStore = create<AccessControlStore>()(
@@ -62,7 +61,7 @@ export const useAccessStore = create<AccessControlStore>()(
},
}),
{
name: ACCESS_KEY,
name: StoreKey.Access,
version: 1,
},
),