minhnt-dev: validate dataResult

This commit is contained in:
MoreStrive
2024-05-30 22:53:28 +07:00
parent b52352660d
commit c36a985b88
2 changed files with 8 additions and 6 deletions
@@ -23,10 +23,12 @@ const _dataResult = computed(() => {
<template> <template>
<div> <div>
<div class="flex gap-4 items-end py-2" @click="selectComponent"> <div class="flex gap-4 items-end py-2">
<nuxt-link :to="`/${component.code}`" v-for="(component, index) in _dataResult" :key="index" class="font-medium text-[18px] first:font-600 first:text-[24px]"> <template v-for="(component, index) in _dataResult">
<h3 class="m-0 leading-none hover:text-primary-100 transition-all duration-300">{{ component.title }}</h3> <nuxt-link v-if="component" :key="index" :to="`/${component.code}`" class="font-medium text-[18px] first:font-600 first:text-[24px]">
</nuxt-link> <h3 class="m-0 leading-none hover:text-primary-100 transition-all duration-300">{{ component.title }}</h3>
</nuxt-link>
</template>
</div> </div>
</div> </div>
</template> </template>
+2 -2
View File
@@ -18,8 +18,8 @@ router.get('/get-by-code/:slug', defineEventHandler(async (event : any) => {
router.get('/get-by-id/:id', defineEventHandler(async (event : any) => { router.get('/get-by-id/:id', defineEventHandler(async (event : any) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const slug = event.context.params.slug; const id = event.context.params.id;
const { item } : any = await $fetch(`${apiUrl}/cms/overview-page/1`) const { item } : any = await $fetch(`${apiUrl}/cms/overview-page/${id}`)
return item return item
} catch (error) { } catch (error) {