fix: useTitle types (#2369)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #2369 Co-authored-by: Dominik Pschenitschni <mail@celement.de> Co-committed-by: Dominik Pschenitschni <mail@celement.de>
This commit is contained in:
parent
97a11d2e12
commit
9fd17aca18
@ -1,15 +1,15 @@
|
||||
import {computed} from 'vue'
|
||||
import type {Ref} from 'vue'
|
||||
|
||||
import {useTitle as useTitleVueUse, toRef} from '@vueuse/core'
|
||||
import {useTitle as useTitleVueUse, toValue, type UseTitleOptions, type ReadonlyRefOrGetter, type MaybeRef, type MaybeRefOrGetter} from '@vueuse/core'
|
||||
|
||||
type UseTitleParameters = Parameters<typeof useTitleVueUse>
|
||||
|
||||
export function useTitle(...args: UseTitleParameters) {
|
||||
|
||||
const [newTitle, ...restArgs] = args
|
||||
|
||||
const pageTitle = toRef(newTitle) as Ref<string>
|
||||
export function useTitle(
|
||||
newTitle:
|
||||
| ReadonlyRefOrGetter<string | null | undefined>
|
||||
| MaybeRef<string | null | undefined>
|
||||
| MaybeRefOrGetter<string | null | undefined> = null,
|
||||
options?: UseTitleOptions,
|
||||
) {
|
||||
const pageTitle = computed(() => toValue(newTitle))
|
||||
|
||||
const completeTitle = computed(() =>
|
||||
(typeof pageTitle.value === 'undefined' || pageTitle.value === '')
|
||||
@ -17,5 +17,5 @@ export function useTitle(...args: UseTitleParameters) {
|
||||
: `${pageTitle.value} | Vikunja`,
|
||||
)
|
||||
|
||||
return useTitleVueUse(completeTitle, ...restArgs)
|
||||
return useTitleVueUse(completeTitle, options)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user