From 18c92a957fdcb57520268ec7cedf2483b8527305 Mon Sep 17 00:00:00 2001
From: shamvrueth <145780447+shamvrueth@users.noreply.github.com>
Date: Fri, 25 Oct 2024 00:23:52 +0530
Subject: [PATCH] Update page.jsx
---
src/app/daily-quote/page.jsx | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/app/daily-quote/page.jsx b/src/app/daily-quote/page.jsx
index a7c46f7..0e78b57 100644
--- a/src/app/daily-quote/page.jsx
+++ b/src/app/daily-quote/page.jsx
@@ -8,6 +8,7 @@ export default function DailyQuote() {
const [quote, setQuote] = useState("Loading...");
const [author, setAuthor] = useState("Anonymous");
const [error, setError] = useState();
+ const [copied, setCopied] = useState(false);
useEffect(() => {
async function fetchData() {
@@ -24,6 +25,8 @@ export default function DailyQuote() {
}, []);
const getNewQuote = async () => {
+ setQuote("Loading...");
+ setCopied(false);
const response = await axios.get("/api/quote");
setQuote(response.data[0].q);
setAuthor(response.data[0].a);
@@ -31,6 +34,7 @@ export default function DailyQuote() {
const copyQuote = async () => {
await navigator.clipboard.writeText(`${quote} - ${author}`);
+ setCopied(true);
};
return (
@@ -68,6 +72,7 @@ export default function DailyQuote() {
Copied successfully!
}