How to use the use-http.useGet function in use-http

To help you get started, we’ve selected a few use-http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / DLWorkspace / src / dashboard / src / pages / Jobs / useJobsAll.ts View on Github external
const useJobsAll = (openKillWarn?: boolean,openApproveWan?: boolean): useJobsAll => {
  const [jobsAll, setJobsAll] = useState();
  const { selectedTeam } = React.useContext(TeamContext);
  const params = new URLSearchParams({
    user:'all',
    limit:'100'
  });
  const { data, error, get } = useGet('/api');

  useEffect(() => {
    if (data == null) return;
    setJobsAll(data);

    const timeout = setTimeout(() => {
      get(`/teams/${selectedTeam}/jobs?${params}`);
    }, 3000);
    return () => {
      clearTimeout(timeout);
    }
  }, [data]);

  useEffect(() => {
    setJobsAll(undefined);
    get(`/teams/${selectedTeam}/jobs?${params}`);
github microsoft / DLWorkspace / src / dashboard / src / pages / Jobs / useJobs.ts View on Github external
const useJobs = (): UseJob => {
  const { selectedTeam } = React.useContext(TeamContext);
  const [jobs, setJobs] = useState();
  const { data, error, get } = useGet('/api');
  const params = new URLSearchParams({
    limit:'20'
  });
  useEffect(() => {
    if (data == null) return;
    setJobs(data);
    const timeout = setTimeout(() => {
      get(`/teams/${selectedTeam}/jobs?${params}`);
    }, 3000);
    return () => {
      clearTimeout(timeout);
    }
  }, [data, selectedTeam]);

  useEffect(() => {
    setJobs(undefined);

use-http

- useFetch - managed state, request, response, etc. [![](https://img.shields.io/badge/example-blue.svg)](https://codesandbox.io/s/usefetch-request-response-managed-state-ruyi3?file=/src/index.js) [![](https://img.shields.io/badge/video-red.svg)](https://w

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis