forked from XiaoMo/ChatGPT-Next-Web
Merge pull request #2867 from Yidadaa/bugfix-0919
This commit is contained in:
commit
ebcb2e7837
@ -22,8 +22,7 @@ export interface WebDavConfig {
|
||||
|
||||
export type SyncStore = GetStoreState<typeof useSyncStore>;
|
||||
|
||||
export const useSyncStore = createPersistStore(
|
||||
{
|
||||
const DEFAULT_SYNC_STATE = {
|
||||
provider: ProviderType.WebDAV,
|
||||
useProxy: true,
|
||||
proxyUrl: corsPath(ApiPath.Cors),
|
||||
@ -42,7 +41,10 @@ export const useSyncStore = createPersistStore(
|
||||
|
||||
lastSyncTime: 0,
|
||||
lastProvider: "",
|
||||
},
|
||||
};
|
||||
|
||||
export const useSyncStore = createPersistStore(
|
||||
DEFAULT_SYNC_STATE,
|
||||
(set, get) => ({
|
||||
coundSync() {
|
||||
const config = get()[get().provider];
|
||||
@ -108,6 +110,16 @@ export const useSyncStore = createPersistStore(
|
||||
}),
|
||||
{
|
||||
name: StoreKey.Sync,
|
||||
version: 1,
|
||||
version: 1.1,
|
||||
|
||||
migrate(persistedState, version) {
|
||||
const newState = persistedState as typeof DEFAULT_SYNC_STATE;
|
||||
|
||||
if (version < 1.1) {
|
||||
newState.upstash.username = STORAGE_KEY;
|
||||
}
|
||||
|
||||
return newState as any;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user