(
modelName: string,
baseContext: Partial<Context> = { type: 'o' }
)
| 324 | } |
| 325 | |
| 326 | const getActions = ( |
| 327 | modelName: string, |
| 328 | baseContext: Partial<Context> = { type: 'o' } |
| 329 | ) => { |
| 330 | const updaters: any = {} |
| 331 | Object.keys(Global.Actions[modelName]).forEach( |
| 332 | (key) => |
| 333 | (updaters[key] = async (params: any, middlewareConfig?: any) => { |
| 334 | const context: InnerContext = { |
| 335 | action: Global.Actions[modelName][key], |
| 336 | actionName: key, |
| 337 | consumerActions, |
| 338 | middlewareConfig, |
| 339 | modelName, |
| 340 | newState: null, |
| 341 | params, |
| 342 | ...baseContext, |
| 343 | Global |
| 344 | } |
| 345 | if (Global.Middlewares[modelName]) { |
| 346 | return await applyMiddlewares(Global.Middlewares[modelName], context) |
| 347 | } else { |
| 348 | return await applyMiddlewares(actionMiddlewares, context) |
| 349 | } |
| 350 | }) |
| 351 | ) |
| 352 | return updaters |
| 353 | } |
| 354 | |
| 355 | const useStore = (modelName: string, selector?: Function) => { |
| 356 | const setState = useState({})[1] |
no test coverage detected
searching dependent graphs…