[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
772 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import { Action } from 'redux'
  2. import { RequestKey } from '../types'
  3. export interface StartRequestAction extends Action {
  4. type: 'REQUESTS_START_REQUEST'
  5. payload: {
  6. id: RequestKey
  7. }
  8. }
  9. export interface FinishRequestAction extends Action {
  10. type: 'REQUESTS_FINISH_REQUEST'
  11. payload: {
  12. id: RequestKey
  13. succeeded: boolean
  14. }
  15. }
  16. export type RequestsActions = StartRequestAction | FinishRequestAction
  17. export const startRequest = (id: RequestKey): StartRequestAction => ({
  18. type: 'REQUESTS_START_REQUEST',
  19. payload: {
  20. id,
  21. },
  22. })
  23. export const finishRequest = (id: RequestKey, succeeded: boolean): FinishRequestAction => ({
  24. type: 'REQUESTS_FINISH_REQUEST',
  25. payload: {
  26. id,
  27. succeeded,
  28. },
  29. })