Default sidebar and WIP PluginLoader
This commit is contained in:
7
lib/hooks.ts
Normal file
7
lib/hooks.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { TypedUseSelectorHook, useDispatch, useSelector } from "react-redux"
|
||||
|
||||
import type { AppDispatch, AppState } from "./store"
|
||||
|
||||
export const useAppDispatch = () => useDispatch<AppDispatch>()
|
||||
|
||||
export const useAppSelector: TypedUseSelectorHook<AppState> = useSelector
|
||||
26
lib/store.ts
Normal file
26
lib/store.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { configureStore, ThunkAction, Action } from "@reduxjs/toolkit"
|
||||
import plugins from "../slices/plugins"
|
||||
|
||||
import pluginsReducer from "../slices/plugins"
|
||||
import pluginsTxtReducer from "../slices/pluginsTxt"
|
||||
|
||||
export function makeStore() {
|
||||
return configureStore({
|
||||
reducer: { pluginsTxt: pluginsTxtReducer, plugins: pluginsReducer },
|
||||
})
|
||||
}
|
||||
|
||||
const store = makeStore()
|
||||
|
||||
export type AppState = ReturnType<typeof store.getState>
|
||||
|
||||
export type AppDispatch = typeof store.dispatch
|
||||
|
||||
export type AppThunk<ReturnType = void> = ThunkAction<
|
||||
ReturnType,
|
||||
AppState,
|
||||
unknown,
|
||||
Action<string>
|
||||
>
|
||||
|
||||
export default store
|
||||
Reference in New Issue
Block a user