blob: 7ff1bfc741f8385f6960a7fa9cdf070b5ba20744 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import type {Action, ThunkAction} from '@reduxjs/toolkit'
import {configureStore} from '@reduxjs/toolkit'
import bucketReducers from "@/models/bucketSlice.ts"
import questionReducers from "@/models/questionSlice.ts"
import appReducers from "@/models/appSlice.ts"
import answerReducers from "@/models/answerSlice.ts"
import cashoutMethodReducers from "@/models/cashoutMethodSlice.ts"
import walletReducers from "@/models/walletSlice.ts"
import upkQuestionReducers from "@/models/upkQuestionSlice"
import userUpkAnswerReducers from "@/models/userUpkAnswerSlice.ts"
import userMarketplaceReducers from "@/models/userMarketplaceAnswerSlice.ts"
import userProfileReducers from "@/models/userProfileSlice.ts"
export const store = configureStore({
reducer: {
app: appReducers,
// - Read Only
// -- These act as API cache stores to allow background loading
buckets: bucketReducers,
questions: questionReducers,
upkQuestions: upkQuestionReducers,
userProfile: userProfileReducers,
userUpkAnswers: userUpkAnswerReducers,
userMarketplaceAnswers: userMarketplaceReducers,
// - Read Write
// -- This stores user engagement (eg: answering any questions)
answers: answerReducers,
cashoutMethods: cashoutMethodReducers,
wallet: walletReducers
}
})
// Infer the type of `store`
export type AppStore = typeof store
// Infer the `AppDispatch` type from the store itself
export type AppDispatch = typeof store.dispatch
// Same for the `RootState` type
export type RootState = ReturnType<typeof store.getState>
// Define a reusable type describing thunk functions
export type AppThunk<ThunkReturnType = void> = ThunkAction<
ThunkReturnType,
RootState,
unknown,
Action
>
|