This commit is contained in:
alsaze
2025-11-17 18:40:04 +03:00
parent 98af218a35
commit 98cbe03fdf
30 changed files with 27121 additions and 0 deletions

2
api/queries/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './useGetPosts'
export * from './useGetUsers'

View File

@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/vue-query'
import { getPosts } from '~/api/endpoints'
export const useGetPosts = (search: MaybeRef<string>) => {
return useQuery<Posts>({
queryKey: ['get-posts', search],
queryFn: () => getPosts(unref(search)),
staleTime: Infinity,
})
}

View File

@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/vue-query'
import { getUsers } from '~/api/endpoints'
export const useGetUsers = () => {
return useQuery<Users>({
queryKey: ['get-users'],
queryFn: getUsers,
staleTime: Infinity,
})
}