building out frontend

This commit is contained in:
KS Jannette
2026-02-11 14:12:05 -05:00
parent dd816d3984
commit bdc88f5d16
3 changed files with 5 additions and 14 deletions

View File

@@ -0,0 +1 @@
import type { Sticky } from '../types/types';

View File

@@ -1,19 +1,9 @@
import { useQuery } from '@tanstack/react-query'; import { useState} from "react";
import type { Sticky } from '../types/types';
const fetchStickies = async (): Promise<Sticky[]> => {
const response = await fetch('http://localhost:3001/api/notes');
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
};
const Stickies = () => { const Stickies = () => {
const { data, isLoading, error } = useQuery({ const isLoading = useState(false);
queryKey: ['stickies'], const error = useState(false);
queryFn: fetchStickies, let data: any = [];
});
if (isLoading) return <div>Loading...</div>; if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>; if (error) return <div>Error: {error.message}</div>;