feat: 🚧 refacto action
All checks were successful
repod / xml (push) Successful in 19s
repod / php (push) Successful in 53s
repod / nodejs (push) Successful in 2m39s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-03-05 00:14:21 +01:00
parent e52d20ffbc
commit 624c52c231

View File

@ -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'))