Refactor withDefaults

environments/review-front-deve-otr6gc/deployments/13419
Kasper Seweryn 2022-05-01 17:21:33 +02:00 zatwierdzone przez Georg Krause
rodzic e29819f314
commit 2f8f7cbafa
6 zmienionych plików z 32 dodań i 40 usunięć

Wyświetl plik

@ -7,10 +7,9 @@ interface Props {
size?: string
}
const { isLoading, size } = toRefs(withDefaults(
defineProps<Props>(),
{ size: 'small' }
))
const { isLoading, size } = toRefs(withDefaults(defineProps<Props>(), {
size: 'small'
}))
const isDone = refAutoReset(false, 2000)
watch(isLoading, loading => {

Wyświetl plik

@ -12,15 +12,12 @@ interface Props {
truncateLength?: number
}
const { displayName, actor, truncateLength, admin, avatar } = toRefs(withDefaults(
defineProps<Props>(),
{
avatar: true,
admin: false,
displayName: false,
truncateLength: 30
}
))
const { displayName, actor, truncateLength, admin, avatar } = toRefs(withDefaults(defineProps<Props>(), {
avatar: true,
admin: false,
displayName: false,
truncateLength: 30
}))
const repr = computed(() => {
const name = displayName.value || actor.value.is_local

Wyświetl plik

@ -8,10 +8,9 @@ interface Props {
icon?: boolean
}
const props = withDefaults(
defineProps<Props>(),
{ icon: false }
)
const props = withDefaults(defineProps<Props>(), {
icon: false
})
const date = computed(() => new Date(props.date))
// TODO (wvffle): Translate useTimeAgo

Wyświetl plik

@ -12,14 +12,11 @@ interface Props {
additionalClasses?: string[]
}
const props = withDefaults(
defineProps<Props>(),
{
fullscreen: true,
scrolling: false,
additionalClasses: () => []
}
)
const props = withDefaults(defineProps<Props>(), {
fullscreen: true,
scrolling: false,
additionalClasses: () => []
})
const emit = defineEmits(['approved', 'deny', 'update:show', 'show', 'hide'])

Wyświetl plik

@ -11,16 +11,13 @@ interface Props {
detailRoute?: string
}
const props = withDefaults(
defineProps<Props>(),
{
showMore: true,
truncateSize: 25,
limit: 5,
labelClasses: '',
detailRoute: 'library.tags.detail'
}
)
const props = withDefaults(defineProps<Props>(), {
showMore: true,
truncateSize: 25,
limit: 5,
labelClasses: '',
detailRoute: 'library.tags.detail'
})
const honorLimit = ref(true)

Wyświetl plik

@ -5,16 +5,19 @@ import { computed } from 'vue'
import { useGettext } from 'vue3-gettext'
import { useStore } from 'vuex'
interface Props {
next?: string
}
const props = withDefaults(defineProps<Props>(), {
next: '/library'
})
const { $pgettext } = useGettext()
const labels = computed(() => ({
title: $pgettext('Head/Login/Title', 'Log In')
}))
const props = withDefaults(
defineProps<{ next?: string }>(),
{ next: '/library' }
)
const store = useStore()
if (store.state.auth.authenticated) {
const router = useRouter()