refactor: 将数据获取从app端移至server端
- 调整数据获取位置以提升安全性 - 对于后端状态为Archived的数据,通过server控制不进行获取
This commit is contained in:
@ -34,9 +34,7 @@
|
||||
];
|
||||
const { data, pending, error } = await useCompanyProfile();
|
||||
|
||||
const content = computed(() =>
|
||||
toCompanyProfileView(data.value.company_profile)
|
||||
);
|
||||
const content = computed(() => toCompanyProfileView(data.value));
|
||||
|
||||
watch(error, (value) => {
|
||||
if (value) {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
const { data, pending, error } = await useHomepage();
|
||||
|
||||
const homepageData = computed(() => {
|
||||
return toHomepageView(data.value.homepage);
|
||||
return toHomepageView(data.value);
|
||||
});
|
||||
|
||||
const pageTilte = $t('page-title.homepage');
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
const { data, pending, error } = await useProduct(id);
|
||||
|
||||
const rawProduct = computed(() => data.value.products_by_id ?? null);
|
||||
const rawProduct = computed(() => data.value ?? null);
|
||||
|
||||
const product = computed(() => {
|
||||
if (rawProduct.value === null) {
|
||||
@ -61,10 +61,10 @@
|
||||
});
|
||||
|
||||
// SEO
|
||||
// usePageSeo({
|
||||
// title: product.value.name || $t('page-title.products'),
|
||||
// description: product.value.summary || '',
|
||||
// });
|
||||
usePageSeo({
|
||||
title: product.value.name || $t('page-title.products'),
|
||||
description: product.value.summary || '',
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
{ label: $t('navigation.products') },
|
||||
];
|
||||
|
||||
const productsRaw = computed(() => data.value.products ?? []);
|
||||
const productsRaw = computed(() => data.value ?? []);
|
||||
|
||||
const products = computed(() =>
|
||||
productsRaw.value.map((item) => toProductListView(item))
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
if (!data.value) {
|
||||
return null;
|
||||
}
|
||||
return toSolutionView(data.value.solutions_by_id);
|
||||
return toSolutionView(data.value);
|
||||
});
|
||||
|
||||
const breadcrumbItems = computed(() => [
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
const { data, pending, error } = await useSolutionList();
|
||||
|
||||
const solutionsRaw = computed(() => data.value.solutions ?? []);
|
||||
const solutionsRaw = computed(() => data.value ?? []);
|
||||
const solutions = computed(() =>
|
||||
solutionsRaw.value.map((item) => toSolutionListView(item))
|
||||
);
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
];
|
||||
const { data, pending, error } = await useContactInfo();
|
||||
|
||||
const content = computed(() => toContactInfoView(data.value.contact_info));
|
||||
const content = computed(() => toContactInfoView(data.value));
|
||||
|
||||
watch(error, (value) => {
|
||||
if (value) {
|
||||
|
||||
@ -38,9 +38,7 @@
|
||||
const { data, pending, error } = await useDocumentList();
|
||||
|
||||
const documents = computed(
|
||||
() =>
|
||||
data?.value.product_documents.map((item) => toDocumentListView(item)) ??
|
||||
[]
|
||||
() => data?.value.map((item) => toDocumentListView(item)) ?? []
|
||||
);
|
||||
|
||||
const productTypeOptions = computed(() => {
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
const { data, pending, error } = await useQuestionList();
|
||||
|
||||
const questions = computed(
|
||||
() => data.value.questions.map((item) => toQuestionListView(item)) ?? null
|
||||
() => data.value.map((item) => toQuestionListView(item)) ?? null
|
||||
);
|
||||
|
||||
const productTypeOptions = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user