|
@@ -1,4 +1,4 @@
|
|
|
-import { LIMIT, ROUTES } from "../../../utils/constants";
|
|
|
+import { LIMIT, ROUTES, STATUSES } from "../../../utils/constants";
|
|
|
import { getGQL } from "../../../utils/getGQL";
|
|
|
import {
|
|
|
createPlaylistQuery,
|
|
@@ -13,94 +13,94 @@ import types from "../types";
|
|
|
|
|
|
const createPlaylistPending = () => ({
|
|
|
type: types.CREATE_PLAYLIST_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const createPlaylistSuccess = (id) => ({
|
|
|
type: types.CREATE_PLAYLIST_SUCCESS,
|
|
|
payload: id,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
});
|
|
|
const createPlaylistFail = () => ({
|
|
|
type: types.CREATE_PLAYLIST_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const getPlaylistsCountPending = () => ({
|
|
|
type: types.GET_PLAYLISTS_COUNT_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const getPlaylistsCountSuccess = (value) => ({
|
|
|
type: types.GET_PLAYLISTS_COUNT_SUCCESS,
|
|
|
payload: value,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
});
|
|
|
const getPlaylistsCountFail = () => ({
|
|
|
type: types.GET_PLAYLISTS_COUNT_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const getPlaylistsPending = () => ({
|
|
|
type: types.GET_PLAYLISTS_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const getPlaylistsSuccess = (playlists) => ({
|
|
|
type: types.GET_PLAYLISTS_SUCCESS,
|
|
|
payload: playlists,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
});
|
|
|
const getPlaylistsFail = () => ({
|
|
|
type: types.GET_PLAYLISTS_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const getPlaylistByIdPending = () => ({
|
|
|
type: types.GET_PLAYLIST_BY_ID_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const getPlaylistByIdSuccess = (playlist) => ({
|
|
|
type: types.GET_PLAYLIST_BY_ID_SUCCESS,
|
|
|
payload: playlist,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
});
|
|
|
const getPlaylistByIdFail = () => ({
|
|
|
type: types.GET_PLAYLIST_BY_ID_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const upsertPlaylistInfoPending = () => ({
|
|
|
type: types.PLAYLIST_UPSERT_INFO_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const upsertPlaylistInfoSuccess = (playlist) => ({
|
|
|
type: types.PLAYLIST_UPSERT_INFO_SUCCESS,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
payload: playlist,
|
|
|
});
|
|
|
const upsertPlaylistInfoFail = () => ({
|
|
|
type: types.PLAYLIST_UPSERT_INFO_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const removeTrackFromPlaylistPending = () => ({
|
|
|
type: types.REMOVE_TRACK_FROM_PLAYLIST_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const removeTrackFromPlaylistSuccess = (tracks, playlistId) => ({
|
|
|
type: types.REMOVE_TRACK_FROM_PLAYLIST_SUCCESS,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
payload: { tracks, playlistId },
|
|
|
});
|
|
|
const removeTrackFromPlaylistFail = () => ({
|
|
|
type: types.REMOVE_TRACK_FROM_PLAYLIST_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
const addTrackToPlaylistPending = () => ({
|
|
|
type: types.ADD_TRACK_TO_PLAYLIST_PENDING,
|
|
|
- status: "PENDING",
|
|
|
+ status: STATUSES.PENDING,
|
|
|
});
|
|
|
const addTrackToPlaylistSuccess = (tracks) => ({
|
|
|
type: types.ADD_TRACK_TO_PLAYLIST_SUCCESS,
|
|
|
payload: tracks,
|
|
|
- status: "SUCCESS",
|
|
|
+ status: STATUSES.SUCCESS,
|
|
|
});
|
|
|
const addTrackToPlaylistFail = () => ({
|
|
|
type: types.ADD_TRACK_TO_PLAYLIST_FAIL,
|
|
|
- status: "FAIL",
|
|
|
+ status: STATUSES.FAIL,
|
|
|
});
|
|
|
|
|
|
export const actionCreatePlaylist = (navigate) => (dispatch) => {
|