mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-18 05:58:07 +01:00
20 lines
497 B
TypeScript
20 lines
497 B
TypeScript
export async function useTalents() {
|
|
const { $trpc } = useNuxtApp()
|
|
|
|
const getTalents = async (category: string, favorite: boolean) => await $trpc.talents.getTalents.query({ favorite, category })
|
|
|
|
const {
|
|
data: getCategories,
|
|
} = await $trpc.talents.getCategories.useQuery()
|
|
|
|
function getCategoryById(id: number) {
|
|
return getCategories.value?.find(category => category.id === id)?.name || 'Not Found'
|
|
}
|
|
|
|
return {
|
|
getTalents,
|
|
getCategories,
|
|
getCategoryById,
|
|
}
|
|
}
|