Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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}`);
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);