feat: 将/support/contact-us由Strapi迁移至Directus
- 修改相关Vue路由 - 添加相应的视图模型与转换方法
This commit is contained in:
@ -6,3 +6,4 @@ export * from './useSolutionList';
|
||||
export * from './useSolution';
|
||||
export * from './useQuestionList';
|
||||
export * from './useDocumentList';
|
||||
export * from './useContactInfo';
|
||||
|
||||
29
app/composables/directus/useContactInfo.ts
Normal file
29
app/composables/directus/useContactInfo.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { readSingleton } from '@directus/sdk';
|
||||
|
||||
export const useContactInfo = () => {
|
||||
const { $directus } = useNuxtApp();
|
||||
const { getDirectusLocale } = useLocalizations();
|
||||
const locale = getDirectusLocale();
|
||||
|
||||
return useAsyncData(`contact-info-${locale}`, async () => {
|
||||
return await $directus.request(
|
||||
readSingleton('contact_info', {
|
||||
fields: [
|
||||
'id',
|
||||
{
|
||||
translations: ['id', 'content'],
|
||||
},
|
||||
],
|
||||
deep: {
|
||||
translations: {
|
||||
_filter: {
|
||||
languages_code: {
|
||||
_eq: locale,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user