18 lines
454 B
TypeScript
18 lines
454 B
TypeScript
export const useSolution = (id: string) => {
|
|
const { getDirectusLocale } = useLocalizations();
|
|
const locale = getDirectusLocale();
|
|
|
|
return useAsyncData(`solution-${id}-${locale}`, async () => {
|
|
try {
|
|
const data = await $fetch(`/api/cms/solution/${id}`, {
|
|
headers: { 'x-locale': locale },
|
|
});
|
|
|
|
return data;
|
|
} catch (error) {
|
|
logger.error('Error fetching solution: ', error);
|
|
throw error;
|
|
}
|
|
});
|
|
};
|