fix: auto migrate proxy config

This commit is contained in:
Fred
2024-03-14 03:03:46 +08:00
parent 7c04a90d77
commit 066ca9e552
2 changed files with 13 additions and 1 deletions

View File

@@ -118,7 +118,7 @@ export const useSyncStore = createPersistStore(
}),
{
name: StoreKey.Sync,
version: 1.1,
version: 1.2,
migrate(persistedState, version) {
const newState = persistedState as typeof DEFAULT_SYNC_STATE;
@@ -127,6 +127,15 @@ export const useSyncStore = createPersistStore(
newState.upstash.username = STORAGE_KEY;
}
if (version < 1.2) {
if (
(persistedState as typeof DEFAULT_SYNC_STATE).proxyUrl ===
"/api/cors/"
) {
newState.proxyUrl = "";
}
}
return newState as any;
},
},