UNPKG

github-automated-repos

Version:

The library, ReactJS, that gives you the power to control / automate your GitHub data, your projects on the portfolio / website, in your own GitHub in one place!

14 lines (13 loc) 974 B
import { useQuery } from '@tanstack/react-query'; import { fetchRepositories } from './utils/_handleRepository'; /** * @param {string} usernameGitHub - Insert your GitHub username. See in your GitHub Ex.: https://github.com/USERNAME * @param {string} keyWordDeploy - Insert a keyword chosen by you. - This key is responsible for managing your data projects on GitHub in topics field. See in : https://github.com/DIGOARTHUR/github-automated-repos. * @returns {UseQueryResult<IGithubRepos[], Error>} - React Query result containing repositories data with the properties: name, topics[], html_url, description, id, homepage, banner[]. isLoading to await for data TRUE or FALSE. isLoadingError for a bad request TRUE ou FALSE. */ export function useGitHubAutomatedRepos(usernameGitHub, keyWordDeploy) { return useQuery({ queryKey: ['githubRepos', usernameGitHub, keyWordDeploy], queryFn: () => fetchRepositories(usernameGitHub, keyWordDeploy), }); }