diff --git a/src/store/player.js b/src/store/player.js index eb19fd6..edc357b 100644 --- a/src/store/player.js +++ b/src/store/player.js @@ -1,3 +1,4 @@ +import { EventBus } from './bus.js' import axios from '@nextcloud/axios' import { decodeUrl } from '../utils/url.js' import { formatEpisodeTimestamp } from '../utils/time.js' @@ -105,16 +106,21 @@ export const player = { context.dispatch('pause') context.commit('episode', null) }, - time: async (context) => axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [{ - podcast: context.state.podcastUrl, - episode: context.state.episode.url, - guid: context.state.episode.guid, - action: 'play', - timestamp: formatEpisodeTimestamp(new Date()), - started: Math.round(context.state.started), - position: Math.round(audio.currentTime), - total: Math.round(audio.duration), - }]), + time: async (context) => { + const episode = context.state.episode + episode.action = { + podcast: context.state.podcastUrl, + episode: context.state.episode.url, + guid: context.state.episode.guid, + action: 'play', + timestamp: formatEpisodeTimestamp(new Date()), + started: Math.round(context.state.started), + position: Math.round(audio.currentTime), + total: Math.round(audio.duration), + } + axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [episode.action]) + EventBus.$emit('updateEpisodesList', episode) + }, volume: (_, volume) => { audio.volume = volume },