building out frontend
This commit is contained in:
1
frontend/resias/src/api/api.tsx
Normal file
1
frontend/resias/src/api/api.tsx
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import type { Sticky } from '../types/types';
|
||||||
@@ -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>;
|
||||||
|
|||||||
0
frontend/resias/src/components/sticky.tsx
Normal file
0
frontend/resias/src/components/sticky.tsx
Normal file
Reference in New Issue
Block a user