Fix router navigation

This commit is contained in:
wvffle 2022-06-30 03:20:34 +00:00 committed by Georg Krause
parent a28e00708b
commit 33dfeea168
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@ export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>) => {
const config = reactiveComputed(() => {
const name = unref(orderingConfigName) ?? route.name as RouteWithPreferences
return store.state.ui.routePreferences[name]
return { ...store.state.ui.routePreferences[name] }
})
const { paginateBy, ordering, orderingDirection } = toRefs(config)
@ -29,7 +29,10 @@ export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>) => {
field: (str[0] === '-' || str[0] === '+' ? str.slice(1) : str) as OrderingField
})
const onOrderingUpdate = (fn: () => void) => watch(config, fn)
const onOrderingUpdate = (fn: () => void) => {
const stop = watch(config, fn)
return stop
}
return {
paginateBy,

View File

@ -673,9 +673,7 @@ export default createRouter({
path: 'podcasts/',
name: 'library.podcasts.browse',
component: () =>
import(
'~/components/library/Podcasts.vue'
),
import('~/components/library/Podcasts.vue'),
props: route => ({
defaultOrdering: route.query.ordering,
defaultQuery: route.query.query,