From 624c52c231473b4ae2def484859c90745bd59c48 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Tue, 5 Mar 2024 00:14:21 +0100 Subject: [PATCH] feat: :construction: refacto action --- src/components/Feed/Episodes.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Feed/Episodes.vue b/src/components/Feed/Episodes.vue index 19ee056..6fb89fd 100644 --- a/src/components/Feed/Episodes.vue +++ b/src/components/Feed/Episodes.vue @@ -199,7 +199,7 @@ export default { async markAs(episode, read) { try { this.loadingAction = true - await axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{ + const action = { podcast: this.url, episode: episode.url, guid: episode.guid, @@ -208,7 +208,14 @@ export default { started: episode.action ? episode.action.started : 0, position: read ? durationToSeconds(episode.duration) : 0, 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) { console.error(e) showError(t('repod', 'Could not change the status of the episode'))