types.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. export const actionLoadAudio = (track, playlist, indexInPlaylist) => ({
  2. type: "LOAD_TRACK",
  3. track,
  4. playlist,
  5. indexInPlaylist,
  6. });
  7. export const actionFullLoadAudio = (track, playlist, indexInPlaylist) => ({
  8. type: "FULL_LOAD_TRACK",
  9. track,
  10. playlist,
  11. indexInPlaylist,
  12. });
  13. export const actionPlayAudio = ({ isPlaying }) => ({
  14. type: "PLAY_TRACK",
  15. isPlaying,
  16. });
  17. export const actionFullPlayAudio = (isPlaying) => ({
  18. type: "FULL_PLAY_TRACK",
  19. isPlaying,
  20. });
  21. export const actionPauseAudio = ({ isPaused }) => ({
  22. type: "PAUSE_TRACK",
  23. isPaused,
  24. });
  25. export const actionFullPauseAudio = (isPaused) => ({
  26. type: "FULL_PAUSE_TRACK",
  27. isPaused,
  28. });
  29. export const actionPrevTrack = (indexInPlaylist) => ({
  30. type: "PREV_TRACK",
  31. indexInPlaylist,
  32. });
  33. export const actionNextTrack = (indexInPlaylist) => ({
  34. type: "NEXT_TRACK",
  35. indexInPlaylist,
  36. });
  37. export const actionSetCurrentTimeTrack = (currentTime) => ({
  38. type: "SET_CURRENT_TIME_TRACK",
  39. currentTime,
  40. });
  41. export const actionFullSetCurrentTimeTrack = (currentTime) => ({
  42. type: "FULL_SET_CURRENT_TIME_TRACK",
  43. currentTime,
  44. });
  45. export const actionSetSeekTimeTrack = (seekTime) => ({
  46. type: "SET_SEEK_TIME_TRACK",
  47. currentTime: seekTime,
  48. });
  49. export const actionFullSetSeekTimeTrack = (seekTime) => ({
  50. type: "FULL_SET_SEEK_TIME_TRACK",
  51. seekTime,
  52. });
  53. export const actionSetVolume = (volume) => ({
  54. type: "SET_VOLUME",
  55. volume,
  56. });
  57. export const actionFullSetVolume = (volume) => ({
  58. type: "FULL_SET_VOLUME",
  59. volume,
  60. });
  61. export const actionSetDuration = (duration) => ({
  62. type: "SET_DURATION",
  63. duration,
  64. });
  65. export const actionFullSetDuration = (duration) => ({
  66. type: "FULL_SET_DURATION",
  67. duration,
  68. });
  69. export const actionPending = (name) => ({
  70. type: "PROMISE",
  71. status: "PENDING",
  72. name,
  73. });
  74. export const actionResolved = (name, payload) => ({
  75. type: "PROMISE",
  76. status: "RESOLVED",
  77. name,
  78. payload,
  79. });
  80. export const actionRejected = (name, error) => ({
  81. type: "PROMISE",
  82. status: "REJECTED",
  83. name,
  84. error,
  85. });
  86. export const actionAuthLogin = (token) => ({ type: "AUTH_LOGIN", token });
  87. export const actionAuthLogout = () => ({ type: "AUTH_LOGOUT" });
  88. export const actionPromise = (name, promise) => ({
  89. type: "PROMISE_START",
  90. name,
  91. promise,
  92. });
  93. export const actionAboutMe = () => ({
  94. type: "ABOUT_ME",
  95. });
  96. export const actionFullLogin = (login, password) => ({
  97. type: "FULL_LOGIN",
  98. login,
  99. password,
  100. });
  101. export const actionFullRegister = (login, password) => ({
  102. type: "FULL_REGISTER",
  103. login,
  104. password,
  105. });
  106. export const actionSetAvatar = (file) => ({
  107. type: "SET_AVATAR",
  108. file,
  109. });
  110. export const actionSetNickname = ({ _id, nick }) => ({
  111. type: "SET_NICKNAME",
  112. _id,
  113. nick,
  114. });
  115. export const actionSetEmail = ({ _id, login }) => ({
  116. type: "SET_EMAIL",
  117. _id,
  118. login,
  119. });
  120. export const actionSetNewPassword = (login, password, newPassword) => ({
  121. type: "SET_NEW_PASSWORD",
  122. login,
  123. password,
  124. newPassword,
  125. });
  126. export const actionSearch = (text) => ({ type: "SEARCH", text });
  127. export const actionSearchResult = (payload) => ({
  128. type: "SEARCH_RESULT",
  129. payload,
  130. });
  131. export const actionSetSearch = (action) => ({ type: "SET_SEARCH", action });
  132. export const actionLoadNewTracks = (newTracks) => ({
  133. type: "ADD_TRACKS",
  134. newTracks,
  135. });
  136. export const actionFullLoadNewTracks = (newTracks) => ({
  137. type: "FULL_ADD_TRACKS",
  138. newTracks,
  139. });
  140. export const actionSkipTracks = (skipTracks) => ({
  141. type: "ADD_SKIP",
  142. skipTracks,
  143. });
  144. export const actionFullSkipTracks = (skipTracks) => ({
  145. type: "FULL_ADD_SKIP",
  146. skipTracks,
  147. });
  148. export const actionClearTracks = () => ({
  149. type: "CLEAR_SKIP",
  150. });
  151. export const actionFullClearTracks = () => ({
  152. type: "FULL_CLEAR_SKIP",
  153. });
  154. export const actionAllTracks = (skip) => ({
  155. type: "FIND_ALL_TRACKS",
  156. skip,
  157. });
  158. export const actionTracksUser = (_id) => ({
  159. type: "FIND_USER_TRACKS",
  160. _id,
  161. });
  162. export const actionFindUserPlaylists = () => ({ type: "FIND_PLAYLISTS" });
  163. export const actionCreateNewPlaylist = (name) => ({
  164. type: "CREATE_PLAYLIST",
  165. name,
  166. });
  167. export const actionPlaylistTracks = (_id) => ({
  168. type: "PLAYLIST_TRACKS",
  169. _id,
  170. });
  171. export const actionTracksToPlaylist = (idPlaylist, array) => ({
  172. type: "LOAD_TRACKS_PLAYLIST",
  173. idPlaylist,
  174. array,
  175. });
  176. export const actionUploadTracks = (file) => ({
  177. type: "UPLOAD_TRACKS",
  178. file,
  179. });