Rename Credentials2/Cache2 (left-overs from the etebase migration).

master
Tom Hacohen 4 years ago
parent abf2224d31
commit 346dc95cee

@ -11,12 +11,12 @@ import {
SettingsType,
fetchCount, credentials, settingsReducer, encryptionKeyReducer, errorsReducer,
syncGeneral, syncCollections, collections, items,
SyncGeneralData, SyncCollectionsData, CacheCollectionsData, CacheItemsData, CredentialsData2,
SyncGeneralData, SyncCollectionsData, CacheCollectionsData, CacheItemsData, CredentialsData,
} from "./reducers";
export interface StoreState {
fetchCount: number;
credentials2: CredentialsData2;
credentials2: CredentialsData;
settings: SettingsType;
encryptionKey: {key: string};
sync: {
@ -49,7 +49,7 @@ const settingsPersistConfig = {
migrate: createMigrate(settingsMigrations, { debug: false }),
};
const credentials2PersistConfig = {
const credentialsPersistConfig = {
key: "credentials2",
version: 0,
storage: localforage,
@ -82,7 +82,7 @@ const syncPersistConfig = {
transforms: [createTransform(syncSerialize, syncDeserialize)],
};
const cache2Serialize = (state: any, key: string | number) => {
const cacheSerialize = (state: any, key: string | number) => {
if (key === "collections") {
return state.toJS();
} else if (key === "items") {
@ -92,7 +92,7 @@ const cache2Serialize = (state: any, key: string | number) => {
return state;
};
const cache2Deserialize = (state: any, key: string | number) => {
const cacheDeserialize = (state: any, key: string | number) => {
if (key === "collections") {
return ImmutableMap(state);
} else if (key === "items") {
@ -104,23 +104,23 @@ const cache2Deserialize = (state: any, key: string | number) => {
return state;
};
const cache2PersistConfig = {
const cachePersistConfig = {
key: "cache2",
version: 0,
storage: localforage,
transforms: [createTransform(cache2Serialize, cache2Deserialize)] as any,
transforms: [createTransform(cacheSerialize, cacheDeserialize)] as any,
};
const reducers = combineReducers({
fetchCount,
settings: persistReducer(settingsPersistConfig, settingsReducer),
credentials2: persistReducer(credentials2PersistConfig, credentials),
credentials2: persistReducer(credentialsPersistConfig, credentials),
encryptionKey: persistReducer(encryptionKeyPersistConfig, encryptionKeyReducer),
sync: persistReducer(syncPersistConfig, combineReducers({
collections: syncCollections,
general: syncGeneral,
})),
cache2: persistReducer(cache2PersistConfig, combineReducers({
cache2: persistReducer(cachePersistConfig, combineReducers({
collections,
items,
})),

@ -30,14 +30,14 @@ export type SyncGeneralData = {
lastSyncDate: Date;
};
export interface CredentialsData2 {
export interface CredentialsData {
storedSession?: string;
}
export const credentials = handleActions(
{
[actions.login.toString()]: (
state: CredentialsData2, action: Action<string>) => {
state: CredentialsData, action: Action<string>) => {
if (action.error) {
return state;
} else if (action.payload === undefined) {
@ -48,7 +48,7 @@ export const credentials = handleActions(
};
}
},
[actions.logout.toString()]: (_state: CredentialsData2, _action: any) => {
[actions.logout.toString()]: (_state: CredentialsData, _action: any) => {
return { storedSession: undefined };
},
},

Loading…
Cancel
Save