mirror of
https://github.com/zebrajr/Reactive-Resume.git
synced 2025-12-06 00:20:04 +01:00
25 lines
610 B
TypeScript
25 lines
610 B
TypeScript
import { AuthProvidersDto } from "@reactive-resume/dto";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { AUTH_PROVIDERS_KEY } from "@/client/constants/query-keys";
|
|
import { axios } from "@/client/libs/axios";
|
|
|
|
export const getAuthProviders = async () => {
|
|
const response = await axios.get<AuthProvidersDto>(`/auth/providers`);
|
|
|
|
return response.data;
|
|
};
|
|
|
|
export const useAuthProviders = () => {
|
|
const {
|
|
error,
|
|
isPending: loading,
|
|
data: providers,
|
|
} = useQuery({
|
|
queryKey: [AUTH_PROVIDERS_KEY],
|
|
queryFn: getAuthProviders,
|
|
});
|
|
|
|
return { providers, loading, error };
|
|
};
|