Add .gitignore Removed node_modules from previous commit Fix task modes Fix task modes Fix task modes Remove node_modules Update basic task modal Add notes functionality Improve UI Setup views Add scopes Fix projects layout Restructure Fix rest of the UI issues Cleanup old views Add .env to .gitignore
16 lines
367 B
TypeScript
16 lines
367 B
TypeScript
import useSWR from 'swr';
|
|
import { Area } from '../entities/Area';
|
|
import { fetcher } from '../utils/fetcher';
|
|
|
|
const useFetchAreas = () => {
|
|
const { data, error, mutate } = useSWR<Area[]>('/api/areas?active=true', fetcher);
|
|
|
|
return {
|
|
areas: data || [],
|
|
isLoading: !error && !data,
|
|
isError: !!error,
|
|
mutate,
|
|
};
|
|
};
|
|
|
|
export default useFetchAreas;
|