Migrate to vue3 (fix #126) #127

Merged
Xefir merged 32 commits from vue3 into main 2024-08-17 12:24:28 +00:00
4 changed files with 12 additions and 12 deletions
Showing only changes of commit 7efb0327d4 - Show all commits

View File

@ -18,7 +18,7 @@ export const usePlayer = defineStore('player', {
started: 0, started: 0,
}), }),
actions: { actions: {
init: () => { init() {
audio.ondurationchange = () => (this.duration = audio.duration) audio.ondurationchange = () => (this.duration = audio.duration)
audio.onended = () => this.stop() audio.onended = () => this.stop()
audio.onloadeddata = () => (this.loaded = true) audio.onloadeddata = () => (this.loaded = true)
@ -29,7 +29,7 @@ export const usePlayer = defineStore('player', {
audio.ontimeupdate = () => (this.currentTime = audio.currentTime) audio.ontimeupdate = () => (this.currentTime = audio.currentTime)
audio.onvolumechange = () => (this.volume = audio.volume) audio.onvolumechange = () => (this.volume = audio.volume)
}, },
load: async (episode, podcastUrl) => { async load(episode, podcastUrl) {
this.episode = episode this.episode = episode
this.podcastUrl = podcastUrl this.podcastUrl = podcastUrl
@ -63,24 +63,24 @@ export const usePlayer = defineStore('player', {
audio.src = '' audio.src = ''
} }
}, },
pause: () => { pause() {
audio.pause() audio.pause()
this.paused = true this.paused = true
}, },
play: () => { play() {
audio.play() audio.play()
this.paused = false this.paused = false
this.started = audio.currentTime this.started = audio.currentTime
}, },
seek: (currentTime) => { seek(currentTime) {
audio.currentTime = currentTime audio.currentTime = currentTime
this.time() this.time()
}, },
stop: () => { stop() {
this.pause() this.pause()
this.episode = null this.episode = null
}, },
time: () => { time() {
this.episode.action = { this.episode.action = {
podcast: this.podcastUrl, podcast: this.podcastUrl,
episode: this.episode.url, episode: this.episode.url,
@ -95,10 +95,10 @@ export const usePlayer = defineStore('player', {
this.episode.action, this.episode.action,
]) ])
}, },
setVolume: (volume) => { setVolume(volume) {
audio.volume = volume audio.volume = volume
}, },
setRate: (rate) => { setRate(rate) {
audio.playbackRate = rate audio.playbackRate = rate
}, },
}, },

View File

@ -10,7 +10,7 @@ export const useSettings = defineStore('settings', {
}, },
}), }),
actions: { actions: {
setFilters: (filters) => { setFilters(filters) {
this.filters = { ...this.filters, ...filters } this.filters = { ...this.filters, ...filters }
setCookie('repod.filters', JSON.stringify(this.filters), 365) setCookie('repod.filters', JSON.stringify(this.filters), 365)
}, },

View File

@ -7,7 +7,7 @@ export const useSubscriptions = defineStore('subscriptions', {
subscriptions: [], subscriptions: [],
}), }),
actions: { actions: {
fetch: async () => { async fetch() {
const metrics = await axios.get( const metrics = await axios.get(
generateUrl('/apps/gpoddersync/personal_settings/metrics'), generateUrl('/apps/gpoddersync/personal_settings/metrics'),
) )

View File

@ -1,6 +1,6 @@
<template> <template>
<AppContent class="main"> <AppContent class="main">
<NcTextField :label="t('repod', 'Find a podcast')" v-model="search"> <NcTextField v-model="search" :label="t('repod', 'Find a podcast')">
<template #icon> <template #icon>
<Magnify :size="20" /> <Magnify :size="20" />
</template> </template>