mirror of
https://github.com/Funkoala14/knowledgebase_law.git
synced 2025-06-09 05:58:15 +08:00
17 lines
417 B
JavaScript
17 lines
417 B
JavaScript
|
// src/index.ts
|
||
|
function createThunkMiddleware(extraArgument) {
|
||
|
const middleware = ({ dispatch, getState }) => (next) => (action) => {
|
||
|
if (typeof action === "function") {
|
||
|
return action(dispatch, getState, extraArgument);
|
||
|
}
|
||
|
return next(action);
|
||
|
};
|
||
|
return middleware;
|
||
|
}
|
||
|
var thunk = createThunkMiddleware();
|
||
|
var withExtraArgument = createThunkMiddleware;
|
||
|
export {
|
||
|
thunk,
|
||
|
withExtraArgument
|
||
|
};
|