minhnt-dev: validate dataResult
This commit is contained in:
@@ -23,10 +23,12 @@ const _dataResult = computed(() => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex gap-4 items-end py-2" @click="selectComponent">
|
||||
<nuxt-link :to="`/${component.code}`" v-for="(component, index) in _dataResult" :key="index" class="font-medium text-[18px] first:font-600 first:text-[24px]">
|
||||
<div class="flex gap-4 items-end py-2">
|
||||
<template v-for="(component, index) in _dataResult">
|
||||
<nuxt-link v-if="component" :key="index" :to="`/${component.code}`" class="font-medium text-[18px] first:font-600 first:text-[24px]">
|
||||
<h3 class="m-0 leading-none hover:text-primary-100 transition-all duration-300">{{ component.title }}</h3>
|
||||
</nuxt-link>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -18,8 +18,8 @@ router.get('/get-by-code/:slug', defineEventHandler(async (event : any) => {
|
||||
router.get('/get-by-id/:id', defineEventHandler(async (event : any) => {
|
||||
try {
|
||||
const { apiUrl } = useRuntimeConfig().public
|
||||
const slug = event.context.params.slug;
|
||||
const { item } : any = await $fetch(`${apiUrl}/cms/overview-page/1`)
|
||||
const id = event.context.params.id;
|
||||
const { item } : any = await $fetch(`${apiUrl}/cms/overview-page/${id}`)
|
||||
|
||||
return item
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user