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