From d7c46a9eae28046bb26da182abc298dc18ed5a10 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 23 Mar 2025 01:39:11 -0400 Subject: Replacing Astro with Next.JS; Prefix warning; Consistent env vars --- web/src/components/Quotes.jsx | 88 ------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 web/src/components/Quotes.jsx (limited to 'web/src/components') diff --git a/web/src/components/Quotes.jsx b/web/src/components/Quotes.jsx deleted file mode 100644 index 1eb258a..0000000 --- a/web/src/components/Quotes.jsx +++ /dev/null @@ -1,88 +0,0 @@ -import { useState, useEffect } from 'react'; -import '../styles/Quote.css' -import { API_URL } from "astro:env/client"; - -export function PendingQuotes() { - const [quotes, setQuotes] = useState([]); - - const fetchQuotes = async () => { - try { - const response = await fetch(`${API_URL}/api/pending-quotes`); - const data = await response.json(); - setQuotes(data); - } catch (error) { - console.error('Failed to fetch quotes:', error); - } - }; - - useEffect(() => { - fetchQuotes(); - }, []); - - const approveQuote = async (id) => { - try { - const response = await fetch(`${API_URL}/api/approve-quote`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ id }), - }); - - if (response.ok) { - fetchQuotes(); // Refresh the listing after approving the quote - } else { - console.error('Failed to approve quote'); - } - } catch (error) { - console.error('Error approving quote:', error); - } - }; - - const rejectQuote = async (id) => { - try { - const response = await fetch(`${API_URL}/api/reject-quote`, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ id }), - }); - - if (response.ok) { - fetchQuotes(); // Refresh the listing after approving the quote - } else { - console.error('Failed to reject quote'); - } - } catch (error) { - console.error('Error rejecting quote:', error); - } - }; - - return ( -
-

Pending Quotes

- {quotes.length > 0 ? ( - - ) : ( -

No pending quotes available.

- )} -
- ); -} -- cgit v1.2.3