24 lines
890 B
TypeScript
24 lines
890 B
TypeScript
import { configureStore } from '@reduxjs/toolkit'
|
|
import { useDispatch, useSelector, type TypedUseSelectorHook } from 'react-redux'
|
|
import artistsReducer from './slices/artistsSlice'
|
|
import albumsReducer from './slices/albumsSlice'
|
|
import albumTracksReducer from './slices/albumTracksSlice'
|
|
import artistTracksReducer from './slices/artistTracksSlice'
|
|
import trackDetailReducer from './slices/trackDetailSlice'
|
|
|
|
export const store = configureStore({
|
|
reducer: {
|
|
artists: artistsReducer,
|
|
albums: albumsReducer,
|
|
albumTracks: albumTracksReducer,
|
|
artistTracks: artistTracksReducer,
|
|
trackDetail: trackDetailReducer,
|
|
},
|
|
})
|
|
|
|
export type RootState = ReturnType<typeof store.getState>
|
|
export type AppDispatch = typeof store.dispatch
|
|
|
|
export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
|
|
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
|