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,6 +1,6 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { FETCH_COMMIT_URL, FETCH_TAG_URL } from "../constant";
import { FETCH_COMMIT_URL, FETCH_TAG_URL, StoreKey } from "../constant";
import { requestUsage } from "../requests";
export interface UpdateStore {
@@ -16,8 +16,6 @@ export interface UpdateStore {
updateUsage: (force?: boolean) => Promise<void>;
}
export const UPDATE_KEY = "chat-update";
function queryMeta(key: string, defaultValue?: string): string {
let ret: string;
if (document) {
@@ -84,7 +82,7 @@ export const useUpdateStore = create<UpdateStore>()(
},
}),
{
name: UPDATE_KEY,
name: StoreKey.Update,
version: 1,
},
),