-
Notifications
You must be signed in to change notification settings - Fork 1
/
actions.js
84 lines (71 loc) · 1.89 KB
/
actions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
export const actionTypes = {
HYDRATE: 'HYDRATE',
FAILURE: 'FAILURE',
SEARCH_DATA: 'SEARCH_DATA',
SEARCH_DATA_SUCCESS: 'SEARCH_DATA_SUCCESS',
FETCH_SHOW: 'FETCH_SHOW',
FETCH_SHOW_SUCCESS: 'FETCH_SHOW_SUCCESS',
ADD_PLAYLIST: 'ADD_PLAYLIST',
DELETE_PLAYLIST: 'DELETE_PLAYLIST',
ADD_SHOW_TO_PLAYLIST: 'ADD_SHOW_TO_PLAYLIST',
DELETE_SHOW_FROM_PLAYLIST: 'DELETE_SHOW_FROM_PLAYLIST',
ADD_REVIEW: 'ADD_REVIEW',
DELETE_REVIEW: 'DELETE_REVIEW',
FETCH_PLAYLIST: 'FETCH_PLAYLIST',
FETCH_PLAYLIST_SUCCESS: 'FETCH_PLAYLIST_SUCCESS',
};
export function failure(error) {
return {
type: actionTypes.FAILURE,
error,
};
}
export function searchData(term) {
return { type: actionTypes.SEARCH_DATA, term };
}
export function searchDataSuccess(searchResults) {
return {
type: actionTypes.SEARCH_DATA_SUCCESS,
searchResults,
};
}
export const fetchShow = (imdbId) => ({
type: actionTypes.FETCH_SHOW,
imdbId,
});
export const fetchShowSuccess = (fetchedShow) => ({
type: actionTypes.FETCH_SHOW_SUCCESS,
fetchedShow,
});
export const addPlaylist = (playlistName) => ({
type: actionTypes.ADD_PLAYLIST,
playlistName,
});
export const deletePlaylist = (playlistId) => ({
type: actionTypes.DELETE_PLAYLIST,
playlistId,
});
export const addShowToPlaylist = (showAndPlaylist) => ({
type: actionTypes.ADD_SHOW_TO_PLAYLIST,
showAndPlaylist,
});
export const deleteShowFromPlaylist = (showAndPlaylist) => ({
type: actionTypes.DELETE_SHOW_FROM_PLAYLIST,
showAndPlaylist,
});
export const addReview = (payload) => ({
type: actionTypes.ADD_REVIEW,
payload,
});
export const deleteReview = (reviewId) => ({
type: actionTypes.DELETE_REVIEW,
reviewId,
});
export const fetchPlaylist = (playlist) => ({
type: actionTypes.FETCH_PLAYLIST,
playlist,
});
export const fetchPlaylistSuccess = (fetchedPlaylist) => ({
type: actionTypes.FETCH_PLAYLIST_SUCCESS,
fetchedPlaylist,
});