1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Keep previous tab for next load

This commit is contained in:
Zhiyuan Zheng
2021-02-11 23:42:13 +01:00
parent 313b7af4a8
commit 3303864394
4 changed files with 39 additions and 12 deletions

View File

@ -16,6 +16,7 @@ export type ContextsState = {
current: number
hidden: boolean
}
previousTab: 'Tab-Local' | 'Tab-Public' | 'Tab-Notifications' | 'Tab-Me'
}
export const contextsInitialState = {
@ -30,7 +31,8 @@ export const contextsInitialState = {
context: 1,
current: 0,
hidden: false
}
},
previousTab: 'Tab-Local'
}
const contextsSlice = createSlice({
@ -53,15 +55,23 @@ const contextsSlice = createSlice({
) {
state.publicRemoteNotice.hidden = true
}
},
updatePreviousTab: (
state,
action: PayloadAction<ContextsState['previousTab']>
) => {
state.previousTab = action.payload
}
}
})
export const getPublicRemoteNotice = (state: RootState) =>
state.contexts.publicRemoteNotice
export const getPreviousTab = (state: RootState) => state.contexts.previousTab
export const {
updateStoreReview,
updatePublicRemoteNotice
updatePublicRemoteNotice,
updatePreviousTab
} = contextsSlice.actions
export default contextsSlice.reducer