added use get resellers categories
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// imports
|
||||
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { API_ENDPOINTS, QUERY_KEYS } from "~/constants";
|
||||
|
||||
// types
|
||||
|
||||
export type GetResellersCategoriesResponse = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
link: string;
|
||||
image: string;
|
||||
}[];
|
||||
|
||||
const useGetResellersCategories = () => {
|
||||
// state
|
||||
|
||||
const { $axios: axios } = useNuxtApp();
|
||||
|
||||
// methods
|
||||
|
||||
const handleGetResellersCategories = async () => {
|
||||
const { data } = await axios.get<GetResellersCategoriesResponse>(
|
||||
`${API_ENDPOINTS.resellers_products.categories}`
|
||||
);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
return useQuery({
|
||||
queryKey: [QUERY_KEYS.resellers_categories],
|
||||
queryFn: () => handleGetResellersCategories(),
|
||||
});
|
||||
};
|
||||
|
||||
export default useGetResellersCategories;
|
||||
Reference in New Issue
Block a user