aboutsummaryrefslogtreecommitdiff
path: root/src/app/search/page.jsx
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-03-21 10:08:56 +0530
committerreal-zephex <[email protected]>2024-03-21 10:08:56 +0530
commit7932b71d55f621ad5cfa4a96d637ce90f366a10c (patch)
treea51f8e490e09a45cb8064812c0693536692542c7 /src/app/search/page.jsx
parentUpdate README.md (diff)
downloaddramalama-7932b71d55f621ad5cfa4a96d637ce90f366a10c.tar.xz
dramalama-7932b71d55f621ad5cfa4a96d637ce90f366a10c.zip
fixes: anime section is fully server rendered, added a loading screen for info and video page, minor css optimizations
Diffstat (limited to 'src/app/search/page.jsx')
-rw-r--r--src/app/search/page.jsx20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/app/search/page.jsx b/src/app/search/page.jsx
index e6d4f08..00309f6 100644
--- a/src/app/search/page.jsx
+++ b/src/app/search/page.jsx
@@ -5,19 +5,24 @@ import { FaSearch } from "react-icons/fa"; // Import the search icon from react-
import { useState } from "react";
import Image from "next/image";
import Link from "next/link";
+import testFunction from "./api/fetchInfo";
export default function Input() {
const [searchedAnime, setSearchedAnime] = useState(null);
const [loading, setLoading] = useState(null);
+ const [search1, setSearch] = useState(null);
- const handleKeyPress = (event) => {
+ const handleKeyPress = async (event) => {
if (
(event.code === "Enter" ||
event.key === "Enter" ||
event.code === 13) &&
searchedAnime != ""
) {
- fetch_animes(searchedAnime);
+ setLoading(true);
+ let x = await testFunction(searchedAnime);
+ setSearch(x);
+ setLoading(false);
} else if (
(event.code === "Enter" ||
event.key === "Enter" ||
@@ -28,17 +33,6 @@ export default function Input() {
}
};
- const [search1, setSearch] = useState(null);
- const fetch_animes = (title) => {
- fetch("https://dramalama-api.vercel.app/anime/gogoanime/" + title)
- .then(setLoading(true))
- .then((res) => res.json())
- .then((data) => {
- setSearch(data);
- setLoading(false);
- });
- };
-
return (
<div>
<div className="inputContainer">