Fix router navigation
This commit is contained in:
parent
a28e00708b
commit
33dfeea168
|
@ -14,7 +14,7 @@ export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>) => {
|
||||||
|
|
||||||
const config = reactiveComputed(() => {
|
const config = reactiveComputed(() => {
|
||||||
const name = unref(orderingConfigName) ?? route.name as RouteWithPreferences
|
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)
|
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
|
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 {
|
return {
|
||||||
paginateBy,
|
paginateBy,
|
||||||
|
|
|
@ -673,9 +673,7 @@ export default createRouter({
|
||||||
path: 'podcasts/',
|
path: 'podcasts/',
|
||||||
name: 'library.podcasts.browse',
|
name: 'library.podcasts.browse',
|
||||||
component: () =>
|
component: () =>
|
||||||
import(
|
import('~/components/library/Podcasts.vue'),
|
||||||
'~/components/library/Podcasts.vue'
|
|
||||||
),
|
|
||||||
props: route => ({
|
props: route => ({
|
||||||
defaultOrdering: route.query.ordering,
|
defaultOrdering: route.query.ordering,
|
||||||
defaultQuery: route.query.query,
|
defaultQuery: route.query.query,
|
||||||
|
|
Loading…
Reference in New Issue