diff --git a/src/stores/track/duck/operations.js b/src/stores/track/duck/operations.js index b9f785c..195e39f 100644 --- a/src/stores/track/duck/operations.js +++ b/src/stores/track/duck/operations.js @@ -55,7 +55,10 @@ export const createTrackRow = async ( track, token ) => { trackRowEndpoint, track, token - ) + ).then( response => { + dispatch( actions.addRow( response ) ) + return response + }) } export const updateTrackRow = async ( id, track, token ) => { @@ -73,4 +76,27 @@ export const deleteTrackRow = async ( id ) => { ) } -// Track Ratings CRUD \ No newline at end of file +// Track Ratings CRUD + +export const getAllTrackRating = (id) => async ( dispatch ) => { + return await AppService._getList( + trackEndpoint + id + '/ratings/' + ).then( response => { + dispatch( actions.getRatings( response ) ) + }) +} + +export const createTrackRating = (track_id, rating, token) => { + return await AppService._post( + trackEndpoint + track_id + '/rating/', + rating, + token + ) +} + +export const deleteTrackRating = (track_id, rating_id, token) => { + return await AppService._delete( + trackEndpoint + track_id + '/rating/' + rating_id, + token + ) +} \ No newline at end of file