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.

offersActions.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. import {
  2. OFFERS_ADD,
  3. OFFERS_CLEAR,
  4. OFFERS_ERROR,
  5. OFFERS_FEATURED_CLEAR,
  6. OFFERS_FEATURED_ERROR,
  7. OFFERS_FEATURED_FETCH,
  8. OFFERS_FEATURED_SET,
  9. OFFERS_FEATURED_SUCCESS,
  10. OFFERS_FETCH,
  11. OFFERS_FETCH_MORE,
  12. OFFERS_FETCH_MORE_ERROR,
  13. OFFERS_FETCH_MORE_SUCCESS,
  14. OFFERS_HEADER_SET,
  15. OFFERS_MINE_FETCH,
  16. OFFERS_MINE_FETCH_ERROR,
  17. OFFERS_MINE_FETCH_SUCCESS,
  18. OFFERS_MINE_HEADER_FETCH,
  19. OFFERS_MINE_HEADER_FETCH_ERROR,
  20. OFFERS_MINE_HEADER_FETCH_SUCCESS,
  21. OFFERS_MINE_SET,
  22. OFFERS_NO_MORE,
  23. OFFERS_PINNED_ADD,
  24. OFFERS_PINNED_SET,
  25. OFFERS_PROFILE_ERROR,
  26. OFFERS_PROFILE_FETCH,
  27. OFFERS_PROFILE_SET,
  28. OFFERS_PROFILE_SUCCESS,
  29. OFFERS_SET,
  30. OFFERS_SET_TOTAL,
  31. OFFERS_SUCCESS,
  32. OFFER_ADD,
  33. OFFER_ADD_ERROR,
  34. OFFER_ADD_SUCCESS,
  35. OFFER_EDIT,
  36. OFFER_EDIT_ERROR,
  37. OFFER_EDIT_SUCCESS,
  38. OFFER_FEATURED_PAGE_SET,
  39. OFFER_PAGE_SET,
  40. OFFER_PIN,
  41. OFFER_PIN_ERROR,
  42. OFFER_PIN_SUCCESS,
  43. OFFER_REMOVE,
  44. OFFER_REMOVE_ERROR,
  45. OFFER_REMOVE_SUCCESS,
  46. OFFER_SELECTED_CLEAR,
  47. OFFER_SET,
  48. ONE_OFFER_ERROR,
  49. ONE_OFFER_FETCH,
  50. ONE_OFFER_SUCCESS,
  51. } from "./offersActionConstants";
  52. // Fetch offers
  53. export const fetchOffers = (payload) => ({
  54. type: OFFERS_FETCH,
  55. payload,
  56. });
  57. export const fetchOffersSuccess = (payload) => ({
  58. type: OFFERS_SUCCESS,
  59. payload,
  60. });
  61. export const fetchOffersError = (payload) => ({
  62. type: OFFERS_ERROR,
  63. payload,
  64. });
  65. export const clearOffers = () => ({
  66. type: OFFERS_CLEAR,
  67. });
  68. // Fetch offers
  69. export const fetchAllOffers = (payload) => ({
  70. type: OFFERS_FETCH,
  71. payload,
  72. });
  73. export const fetchAllOffersSuccess = (payload) => ({
  74. type: OFFERS_SUCCESS,
  75. payload,
  76. });
  77. export const fetchAllOffersError = (payload) => ({
  78. type: OFFERS_ERROR,
  79. payload,
  80. });
  81. // Fetch featured offers
  82. export const fetchFeaturedOffers = (payload) => ({
  83. type: OFFERS_FEATURED_FETCH,
  84. payload,
  85. });
  86. export const fetchFeaturedOffersSuccess = (payload) => ({
  87. type: OFFERS_FEATURED_SUCCESS,
  88. payload,
  89. });
  90. export const fetchFeaturedOffersError = (payload) => ({
  91. type: OFFERS_FEATURED_ERROR,
  92. payload,
  93. });
  94. export const clearFeaturedOffers = () => ({
  95. type: OFFERS_FEATURED_CLEAR,
  96. });
  97. // Fetch more offers
  98. export const fetchMoreOffers = (payload) => ({
  99. type: OFFERS_FETCH_MORE,
  100. payload,
  101. });
  102. export const fetchMoreOffersSuccess = () => ({
  103. type: OFFERS_FETCH_MORE_SUCCESS,
  104. });
  105. export const fetchMoreOffersError = () => ({
  106. type: OFFERS_FETCH_MORE_ERROR,
  107. });
  108. // Fetch mine offers
  109. export const fetchMineOffers = () => ({
  110. type: OFFERS_MINE_FETCH,
  111. });
  112. export const fetchMineOffersSuccess = () => ({
  113. type: OFFERS_MINE_FETCH_SUCCESS,
  114. });
  115. export const fetchMineOffersError = () => ({
  116. type: OFFERS_MINE_FETCH_ERROR,
  117. });
  118. // Fetch header offers
  119. export const fetchMineHeaderOffers = () => ({
  120. type: OFFERS_MINE_HEADER_FETCH,
  121. });
  122. export const fetchMineHeaderOffersSuccess = () => ({
  123. type: OFFERS_MINE_HEADER_FETCH_SUCCESS,
  124. });
  125. export const fetchMineHeaderOffersError = () => ({
  126. type: OFFERS_MINE_HEADER_FETCH_ERROR,
  127. });
  128. // Fetch profile offers
  129. export const fetchProfileOffers = (payload) => ({
  130. type: OFFERS_PROFILE_FETCH,
  131. payload,
  132. });
  133. export const fetchProfileOffersSuccess = () => ({
  134. type: OFFERS_PROFILE_SUCCESS,
  135. });
  136. export const fetchProfileOffersError = () => ({
  137. type: OFFERS_PROFILE_ERROR,
  138. });
  139. // One offer
  140. export const fetchOneOffer = (payload) => ({
  141. type: ONE_OFFER_FETCH,
  142. payload,
  143. });
  144. export const fetchOneOfferError = (payload) => ({
  145. type: ONE_OFFER_ERROR,
  146. payload,
  147. });
  148. export const fetchOneOfferSuccess = (payload) => ({
  149. type: ONE_OFFER_SUCCESS,
  150. payload,
  151. });
  152. // Add offer
  153. export const addOffer = (payload) => ({
  154. type: OFFER_ADD,
  155. payload,
  156. });
  157. export const addOfferSuccess = () => ({
  158. type: OFFER_ADD_SUCCESS,
  159. });
  160. export const addOfferError = () => ({
  161. type: OFFER_ADD_ERROR,
  162. });
  163. // Remove offer
  164. export const removeOffer = (payload) => ({
  165. type: OFFER_REMOVE,
  166. payload,
  167. });
  168. export const removeOfferSuccess = () => ({
  169. type: OFFER_REMOVE_SUCCESS,
  170. });
  171. export const removeOfferError = () => ({
  172. type: OFFER_REMOVE_ERROR,
  173. });
  174. // Edit offer
  175. export const editOneOffer = (payload) => ({
  176. type: OFFER_EDIT,
  177. payload,
  178. });
  179. export const editOfferSuccess = () => ({
  180. type: OFFER_EDIT_SUCCESS,
  181. });
  182. export const editOfferError = () => ({
  183. type: OFFER_EDIT_ERROR,
  184. });
  185. // Pin/unpin offer
  186. export const pinOffer = (payload) => ({
  187. type: OFFER_PIN,
  188. payload,
  189. });
  190. export const pinOfferSuccess = () => ({
  191. type: OFFER_PIN_SUCCESS,
  192. });
  193. export const pinOfferError = () => ({
  194. type: OFFER_PIN_ERROR,
  195. });
  196. export const setOffers = (payload) => ({
  197. type: OFFERS_SET,
  198. payload,
  199. });
  200. export const setPinnedOffers = (payload) => ({
  201. type: OFFERS_PINNED_SET,
  202. payload,
  203. });
  204. export const addPinnedOffers = (payload) => ({
  205. type: OFFERS_PINNED_ADD,
  206. payload,
  207. });
  208. export const addOffers = (payload) => ({
  209. type: OFFERS_ADD,
  210. payload,
  211. });
  212. export const setNoMoreOffersStatus = (payload) => ({
  213. type: OFFERS_NO_MORE,
  214. payload,
  215. });
  216. export const setTotalOffers = (payload) => ({
  217. type: OFFERS_SET_TOTAL,
  218. payload,
  219. });
  220. export const setMineHeaderOffers = (payload) => ({
  221. type: OFFERS_HEADER_SET,
  222. payload,
  223. });
  224. export const setMineOffers = (payload) => ({
  225. type: OFFERS_MINE_SET,
  226. payload,
  227. });
  228. export const setProfileOffers = (payload) => ({
  229. type: OFFERS_PROFILE_SET,
  230. payload,
  231. });
  232. export const setOffer = (payload) => ({
  233. type: OFFER_SET,
  234. payload,
  235. });
  236. export const setFeaturedOffers = (payload) => ({
  237. type: OFFERS_FEATURED_SET,
  238. payload,
  239. });
  240. export const setOfferPage = (payload) => ({
  241. type: OFFER_PAGE_SET,
  242. payload,
  243. });
  244. export const setFeaturedOfferPage = (payload) => ({
  245. type: OFFER_FEATURED_PAGE_SET,
  246. payload,
  247. });
  248. export const clearSelectedOffer = () => ({
  249. type: OFFER_SELECTED_CLEAR,
  250. });