feat: 🚧 refacto action
This commit is contained in:
parent
e52d20ffbc
commit
624c52c231
@ -199,7 +199,7 @@ export default {
|
|||||||
async markAs(episode, read) {
|
async markAs(episode, read) {
|
||||||
try {
|
try {
|
||||||
this.loadingAction = true
|
this.loadingAction = true
|
||||||
await axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{
|
const action = {
|
||||||
podcast: this.url,
|
podcast: this.url,
|
||||||
episode: episode.url,
|
episode: episode.url,
|
||||||
guid: episode.guid,
|
guid: episode.guid,
|
||||||
@ -208,7 +208,14 @@ export default {
|
|||||||
started: episode.action ? episode.action.started : 0,
|
started: episode.action ? episode.action.started : 0,
|
||||||
position: read ? durationToSeconds(episode.duration) : 0,
|
position: read ? durationToSeconds(episode.duration) : 0,
|
||||||
total: durationToSeconds(episode.duration),
|
total: durationToSeconds(episode.duration),
|
||||||
}])
|
}
|
||||||
|
await axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [action])
|
||||||
|
this.episodes = this.episodes.map((e) => {
|
||||||
|
if (e.url === episode.url) {
|
||||||
|
e.action = action
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
showError(t('repod', 'Could not change the status of the episode'))
|
showError(t('repod', 'Could not change the status of the episode'))
|
||||||
|
Loading…
Reference in New Issue
Block a user