upgrade operations #TODO complete dispatches

develop
TBS093A 2020-08-07 21:00:09 +02:00
parent 553feb7c62
commit 6a7d045405
1 changed files with 28 additions and 2 deletions

View File

@ -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
// 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
)
}