Create get account composable

This commit is contained in:
marzban-dev
2025-01-13 23:44:01 +03:30
parent 3384214c46
commit ee641d76e9
@@ -0,0 +1,29 @@
// imports
import { useQuery } from "@tanstack/vue-query";
import { API_ENDPOINTS, QUERY_KEYS } from "~/constants";
// types
export type GetAccountResponse = Product;
const useGetAccount = () => {
// state
const { $axios: axios } = useNuxtApp();
// methods
const handleGetAccount = async () => {
const { data } = await axios.get<GetAccountResponse>(`${API_ENDPOINTS.account.profile}`);
return data;
};
return useQuery({
queryKey: [QUERY_KEYS.account],
queryFn: () => handleGetAccount()
});
};
export default useGetAccount;