mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-06-07 05:57:41 +00:00
Set title of page
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
22550eafe0
commit
08f4f641fe
3 changed files with 18 additions and 2 deletions
|
@ -3,6 +3,9 @@
|
||||||
"app-title": {
|
"app-title": {
|
||||||
"text": "Wunschlisten"
|
"text": "Wunschlisten"
|
||||||
},
|
},
|
||||||
|
"title": {
|
||||||
|
"text": "Wunschliste: {title}"
|
||||||
|
},
|
||||||
"loading": {
|
"loading": {
|
||||||
"text": "Lade..."
|
"text": "Lade..."
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"app-title": {
|
"app-title": {
|
||||||
"text": "Wishlists"
|
"text": "Wishlists"
|
||||||
},
|
},
|
||||||
|
"title": {
|
||||||
|
"text": "Wishlist: {title}"
|
||||||
|
},
|
||||||
"loading": {
|
"loading": {
|
||||||
"text": "Loading..."
|
"text": "Loading..."
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { Wishlist, WishlistItem as WishlistItemType } from '@/types'
|
import { Wishlist, WishlistItem as WishlistItemType } from '@/types'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
|
import { useTitle } from '@vueuse/core'
|
||||||
import { useWishlistStore, useModal, useEditMode } from '@/composables'
|
import { useWishlistStore, useModal, useEditMode } from '@/composables'
|
||||||
import {
|
import {
|
||||||
FormWishlist,
|
FormWishlist,
|
||||||
|
@ -11,6 +12,7 @@ import {
|
||||||
} from '@/components'
|
} from '@/components'
|
||||||
import { IconNoGift } from '../components/icons'
|
import { IconNoGift } from '../components/icons'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -18,7 +20,6 @@ const modal = useModal()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const { isActive: editModeIsActive } = useEditMode()
|
const { isActive: editModeIsActive } = useEditMode()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
fetch,
|
fetch,
|
||||||
|
@ -30,7 +31,14 @@ const {
|
||||||
itemDelete,
|
itemDelete,
|
||||||
filteredItems,
|
filteredItems,
|
||||||
} = useWishlistStore()
|
} = useWishlistStore()
|
||||||
await fetch(route.params.slug as string)
|
|
||||||
|
const title = computed(() => {
|
||||||
|
return state.value.title
|
||||||
|
? t('common.title.text', { title: state.value.title })
|
||||||
|
: t('common.loading.text')
|
||||||
|
})
|
||||||
|
|
||||||
|
useTitle(title)
|
||||||
|
|
||||||
const handleUpdateWishlist = async (wishlist: Wishlist): Promise<void> => {
|
const handleUpdateWishlist = async (wishlist: Wishlist): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
|
@ -84,6 +92,8 @@ const handleDeleteItem = async (item: WishlistItemType): Promise<void> => {
|
||||||
itemDelete(item)
|
itemDelete(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await fetch(route.params.slug as string)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Add table
Reference in a new issue