Files
jinshen-website/app/composables/directus/useSolution.ts
R2m1liA 0ccd855472
All checks were successful
deploy to server / build-and-deploy (push) Successful in 3m22s
feat: solution页composable API
2025-10-17 16:24:13 +08:00

29 lines
653 B
TypeScript

import { readItem } from '@directus/sdk';
export const useSolution = (id: string) => {
const { $directus } = useNuxtApp();
const { getDirectusLocale } = useLocalizations();
const locale = getDirectusLocale();
return useAsyncData(`solution-${id}-${locale}`, async () => {
return await $directus.request(
readItem('solutions', id, {
fields: [
'id',
{
translations: ['*'],
},
'create_at',
],
deep: {
translations: {
_filter: {
languages_code: { _eq: locale },
},
},
},
})
);
});
};