system-praktyk-front/src/hooks/providers.ts
2020-10-04 14:18:25 +02:00

16 lines
357 B
TypeScript

import { useEffect, useState } from "react";
import api from "@/api";
import { InternshipType } from "@/data";
export const useInternshipTypes = () => {
const [types, setTypes] = useState<InternshipType[]>([]);
useEffect(() => {
(async () => {
setTypes(await api.type.available());
})()
}, [])
return types;
}