tududi/app/frontend/hooks/useFetchNotes.ts
2024-10-27 11:14:20 +02:00

15 lines
348 B
TypeScript

import useFetch from './useFetch';
import { Note } from '../entities/Note';
const useFetchNotes = () => {
const { data, loading, error } = useFetch<Note[]>('/api/notes', {
credentials: 'include',
headers: {
Accept: 'application/json',
},
});
return { notes: data || [], loading, error };
};
export default useFetchNotes;