Cleanup defaultPaginateBy and fix onMounted missing from imports

environments/review-front-deve-otr6gc/deployments/13419
wvffle 2022-06-25 22:29:53 +00:00 zatwierdzone przez Georg Krause
rodzic a8fd0e3f28
commit 78cdb592c5
8 zmienionych plików z 13 dodań i 38 usunięć

Wyświetl plik

@ -17,12 +17,10 @@ import { OrderingField } from '~/store/ui'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
}
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1
defaultPage: 1
})
const store = useStore()
@ -42,7 +40,7 @@ const logger = useLogger()
const sharedLabels = useSharedLabels()
const router = useRouter()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const updateQueryString = () => router.replace({
query: {

Wyświetl plik

@ -17,7 +17,6 @@ import { useStore } from '~/store'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
defaultQuery?: string
defaultTags?: string[]
scope?: string
@ -25,7 +24,6 @@ interface Props extends OrderingProps {
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1,
defaultQuery: '',
defaultTags: () => [],
scope: 'all'
@ -47,7 +45,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const logger = useLogger()
const sharedLabels = useSharedLabels()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const router = useRouter()
const updateQueryString = () => router.replace({

Wyświetl plik

@ -9,7 +9,7 @@ import TagsSelector from '~/components/library/TagsSelector.vue'
import useLogger from '~/composables/useLogger'
import useSharedLabels from '~/composables/locale/useSharedLabels'
import { OrderingField } from '~/store/ui'
import { computed, reactive, ref, watch } from 'vue'
import { computed, reactive, ref, watch, onMounted } from 'vue'
import { useGettext } from 'vue3-gettext'
import { useStore } from '~/store'
import useOrdering, { OrderingProps } from '~/composables/useOrdering'
@ -17,7 +17,6 @@ import { onBeforeRouteUpdate, useRouter } from 'vue-router'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
defaultQuery?: string
defaultTags?: string[]
scope?: string
@ -25,7 +24,6 @@ interface Props extends OrderingProps {
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1,
defaultQuery: '',
defaultTags: () => [],
scope: 'all'
@ -47,7 +45,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const logger = useLogger()
const sharedLabels = useSharedLabels()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const router = useRouter()
const updateQueryString = () => router.replace({

Wyświetl plik

@ -11,7 +11,7 @@ import RemoteSearchForm from '~/components/RemoteSearchForm.vue'
import useLogger from '~/composables/useLogger'
import useSharedLabels from '~/composables/locale/useSharedLabels'
import { OrderingField } from '~/store/ui'
import { computed, reactive, ref, watch } from 'vue'
import { computed, reactive, ref, watch, onMounted } from 'vue'
import useOrdering, { OrderingProps } from '~/composables/useOrdering'
import { useGettext } from 'vue3-gettext'
import { useStore } from '~/store'
@ -19,7 +19,6 @@ import { onBeforeRouteUpdate, useRouter } from 'vue-router'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
defaultQuery?: string
defaultTags?: string[]
@ -28,7 +27,6 @@ interface Props extends OrderingProps {
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1,
defaultQuery: '',
defaultTags: () => [],
scope: 'all'
@ -50,7 +48,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const logger = useLogger()
const sharedLabels = useSharedLabels()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const router = useRouter()
const updateQueryString = () => router.replace({

Wyświetl plik

@ -7,7 +7,7 @@ import Pagination from '~/components/vui/Pagination.vue'
import useLogger from '~/composables/useLogger'
import useSharedLabels from '~/composables/locale/useSharedLabels'
import { OrderingField } from '~/store/ui'
import { computed, ref, watch } from 'vue'
import { computed, ref, watch, onMounted } from 'vue'
import { useGettext } from 'vue3-gettext'
import { useStore } from '~/store'
import { onBeforeRouteUpdate, useRouter } from 'vue-router'
@ -15,7 +15,6 @@ import useOrdering, { OrderingProps } from '~/composables/useOrdering'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
defaultQuery?: string
scope?: string
@ -23,7 +22,6 @@ interface Props extends OrderingProps {
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1,
defaultQuery: '',
scope: 'all'
})
@ -42,7 +40,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const logger = useLogger()
const sharedLabels = useSharedLabels()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const router = useRouter()
const updateQueryString = () => router.replace({

Wyświetl plik

@ -8,7 +8,7 @@ export interface OrderingProps {
orderingConfigName: RouteWithPreferences | null
}
export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>, defaultPaginateBy?: MaybeRef<number>) => {
export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>) => {
const store = useStore()
const route = useRoute()
@ -18,9 +18,6 @@ export default (orderingConfigName: MaybeRef<RouteWithPreferences | null>, defau
})
const { paginateBy, ordering, orderingDirection } = toRefs(config)
if (defaultPaginateBy !== undefined) {
paginateBy.value = unref(defaultPaginateBy)
}
const orderingString = computed(() => {
if (orderingDirection.value === '-') return `-${ordering.value}`

Wyświetl plik

@ -240,8 +240,7 @@ export default createRouter({
import('~/components/favorites/List.vue'),
props: route => ({
defaultOrdering: route.query.ordering,
defaultPage: route.query.page,
defaultPaginateBy: route.query.paginateBy
defaultPage: route.query.page
})
},
{
@ -635,7 +634,6 @@ export default createRouter({
defaultTags: Array.isArray(route.query.tag || [])
? route.query.tag
: [route.query.tag],
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -653,7 +651,6 @@ export default createRouter({
defaultTags: Array.isArray(route.query.tag || [])
? route.query.tag
: [route.query.tag],
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -670,7 +667,6 @@ export default createRouter({
defaultTags: Array.isArray(route.query.tag || [])
? route.query.tag
: [route.query.tag],
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -687,7 +683,6 @@ export default createRouter({
defaultTags: Array.isArray(route.query.tag || [])
? route.query.tag
: [route.query.tag],
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -705,7 +700,6 @@ export default createRouter({
defaultTags: Array.isArray(route.query.tag || [])
? route.query.tag
: [route.query.tag],
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -719,7 +713,6 @@ export default createRouter({
props: route => ({
defaultOrdering: route.query.ordering,
defaultQuery: route.query.query,
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -734,7 +727,6 @@ export default createRouter({
scope: 'me',
defaultOrdering: route.query.ordering,
defaultQuery: route.query.query,
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -771,7 +763,6 @@ export default createRouter({
props: route => ({
defaultOrdering: route.query.ordering,
defaultQuery: route.query.query,
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},
@ -784,7 +775,6 @@ export default createRouter({
scope: 'me',
defaultOrdering: route.query.ordering,
defaultQuery: route.query.query,
defaultPaginateBy: route.query.paginateBy,
defaultPage: route.query.page
})
},

Wyświetl plik

@ -2,7 +2,7 @@
import axios from 'axios'
import $ from 'jquery'
import qs from 'qs'
import { computed, ref, watch } from 'vue'
import { computed, ref, watch, onMounted } from 'vue'
import { useRouter, onBeforeRouteUpdate } from 'vue-router'
import { useGettext } from 'vue3-gettext'
@ -15,14 +15,12 @@ import { OrderingField } from '~/store/ui'
interface Props extends OrderingProps {
defaultPage?: number
defaultPaginateBy?: number
defaultQuery?: string
scope?: string
}
const props = withDefaults(defineProps<Props>(), {
defaultPage: 1,
defaultPaginateBy: 1,
defaultQuery: '',
scope: 'all'
})
@ -42,7 +40,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const logger = useLogger()
const sharedLabels = useSharedLabels()
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName, props.defaultPaginateBy)
const { onOrderingUpdate, orderingString, paginateBy, ordering, orderingDirection } = useOrdering(props.orderingConfigName)
const router = useRouter()
const updateQueryString = () => router.replace({