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 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();
|
||||
};
|
||||
import { useState} from "react";
|
||||
|
||||
const Stickies = () => {
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['stickies'],
|
||||
queryFn: fetchStickies,
|
||||
});
|
||||
const isLoading = useState(false);
|
||||
const error = useState(false);
|
||||
let data: any = [];
|
||||
|
||||
if (isLoading) return <div>Loading...</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