context.ts 668 B

1234567891011121314151617181920212223242526
  1. import {
  2. TableSearchContext,
  3. createPageContext,
  4. createSearchContext,
  5. createTableSearchContext,
  6. } from '@hooks';
  7. import {GetWarehousingFlowingListParams, OriginalListParams} from '@models';
  8. export const pageContext = createPageContext();
  9. export const searchContext = createSearchContext();
  10. export const contextState = {
  11. code: '',
  12. startTime: '',
  13. endTime: '',
  14. };
  15. export const context = createTableSearchContext(contextState);
  16. export function contextSelector(
  17. [{code, startTime, endTime}]: TableSearchContext<typeof contextState>,
  18. ): OriginalListParams<GetWarehousingFlowingListParams> {
  19. return {
  20. wllbCode: code,
  21. startTime,
  22. endTime,
  23. };
  24. }