feat: solution页composable API
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m22s
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m22s
This commit is contained in:
38
app/composables/directus/useSolutionList.ts
Normal file
38
app/composables/directus/useSolutionList.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { readItems } from '@directus/sdk';
|
||||
|
||||
export const useSolutionList = () => {
|
||||
const { $directus } = useNuxtApp();
|
||||
const { getDirectusLocale } = useLocalizations();
|
||||
const locale = getDirectusLocale();
|
||||
|
||||
return useAsyncData(`solution-list-${locale}`, async () => {
|
||||
return await $directus.request(
|
||||
readItems('solutions', {
|
||||
fields: [
|
||||
'id',
|
||||
'cover',
|
||||
{
|
||||
type: ['id', { translations: ['id', 'name'] }],
|
||||
},
|
||||
{
|
||||
translations: ['id', 'title', 'summary'],
|
||||
},
|
||||
],
|
||||
deep: {
|
||||
type: {
|
||||
translations: {
|
||||
_filter: {
|
||||
languages_code: { _eq: locale },
|
||||
},
|
||||
},
|
||||
},
|
||||
translations: {
|
||||
_filter: {
|
||||
languages_code: { _eq: locale },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user