diff options
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/app.ts | 4 | ||||
| -rw-r--r-- | src/models/appSlice.ts | 10 | ||||
| -rw-r--r-- | src/models/questionSlice.ts | 6 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/models/app.ts b/src/models/app.ts index a0412e0..62da7bb 100644 --- a/src/models/app.ts +++ b/src/models/app.ts @@ -10,4 +10,8 @@ export interface App { leaderboard: boolean; currentPage: Page + + //-- responses saved from the last OfferwallResponse + availability_count: number | undefined; + offerwall_id: string | undefined; } diff --git a/src/models/appSlice.ts b/src/models/appSlice.ts index 3adf316..b8c41c6 100644 --- a/src/models/appSlice.ts +++ b/src/models/appSlice.ts @@ -14,12 +14,20 @@ const appSlice = createSlice({ }, setPage(state, action: PayloadAction<Page>) { state.currentPage = action.payload; + }, + setAvailabilityCount(state, action: PayloadAction<number>) { + state.availability_count = action.payload; + }, + setOfferwallId(state, action: PayloadAction<string>) { + state.offerwall_id = action.payload; } } }) export const { setApp, - setPage + setPage, + setAvailabilityCount, + setOfferwallId } = appSlice.actions; export default appSlice.reducer
\ No newline at end of file diff --git a/src/models/questionSlice.ts b/src/models/questionSlice.ts index 9543088..a617234 100644 --- a/src/models/questionSlice.ts +++ b/src/models/questionSlice.ts @@ -58,6 +58,12 @@ export default questionSlice.reducer // We need to fetch the next available Question that either doesn't have an Answer, or the Answer // isn't Answer.completed export const selectQuestions = (state: RootState) => state.questions +export const makeSelectQuestionsByIds = (ids: string[]) => + createSelector( + (state: RootState) => state.questions, + (questions: ProfileQuestion[]) => questions.filter(q => ids.includes(q.question_id)) + ) + export const selectActiveQuestion = (state: RootState) => state.questions.find(i => i.active) export const selectAnswers = (state: RootState) => state.answers |
