tooot/src/utils/migrations/contexts/migration.ts

28 lines
629 B
TypeScript
Raw Normal View History

2021-11-15 23:43:35 +01:00
import { ContextsV0 } from './v0'
2022-01-16 23:26:05 +01:00
import { ContextsV1 } from './v1'
2022-02-12 14:51:01 +01:00
import { ContextsV2 } from './v2'
2022-12-11 01:37:26 +01:00
import { ContextsV3 } from './v3'
2021-11-15 23:43:35 +01:00
const contextsMigration = {
2022-02-12 14:51:01 +01:00
1: (state: ContextsV0): ContextsV1 => {
return {
2021-11-15 23:43:35 +01:00
...state,
mePage: {
lists: { shown: false },
announcements: { shown: false, unread: 0 }
}
2022-02-12 14:51:01 +01:00
}
2022-01-16 23:26:05 +01:00
},
2022-02-12 14:51:01 +01:00
2: (state: ContextsV1): ContextsV2 => {
const { mePage, ...rest } = state
return rest
2022-12-11 01:37:26 +01:00
},
3: (state: ContextsV2): ContextsV3 => {
return { ...state, previousSegment: 'Local' }
2021-11-15 23:43:35 +01:00
}
}
2022-12-11 01:37:26 +01:00
export { ContextsV3 as ContextsLatest }
2021-11-15 23:43:35 +01:00
export default contextsMigration