This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update error handle, infinite scroll, cache
- Loading branch information
Showing
12 changed files
with
257 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export const getAnimeDetail = async (id) => { | ||
const res = await fetch(`https://api.jikan.moe/v4/anime/${id}`); | ||
return res.json(); | ||
}; | ||
|
||
export const getListAnime = async (type) => { | ||
const res = await fetch(`https://api.jikan.moe/v4/${type}`); | ||
return res.json(); | ||
}; | ||
|
||
export const getCharacterDetail = async (id) => { | ||
const res = await fetch(`https://api.jikan.moe/v4/characters/${id}`); | ||
return res.json(); | ||
}; | ||
|
||
export const search = async (url) => { | ||
const res = await fetch(url); | ||
return res.json(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,58 @@ | ||
import { render } from "react-dom"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { lazy, Suspense } from "react"; | ||
import { BrowserRouter, Route, Routes } from "react-router-dom"; | ||
|
||
import App from "./App"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
|
||
import LoadingComponent from "./components/loading/LoadingComponent"; | ||
import ShareLayout from "./components/layout/ShareLayout"; | ||
|
||
const HomePage = lazy(() => import("./page/HomePage")); | ||
const AnimePage = lazy(() => import("./page/AnimePage")); | ||
const SearchPage = lazy(() => import("./page/SearchPage")); | ||
const AnimeDetailPage = lazy(() => import("./page/AnimeDetailPage")); | ||
const CharacterPage = lazy(() => import("./page/CharacterPage")); | ||
const CharacterDetailPage = lazy(() => import("./page/CharacterDetailPage")); | ||
const Error404Page = lazy(() => import("./page/Error404Page")); | ||
|
||
import "swiper/css"; | ||
import "react-toastify/dist/ReactToastify.css"; | ||
import "./index.scss"; | ||
import { ToastContainer } from "react-toastify"; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
render( | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter>, | ||
<QueryClientProvider client={queryClient} contextSharing={true}> | ||
<BrowserRouter> | ||
<Suspense fallback={<LoadingComponent />}> | ||
<Routes> | ||
<Route element={<ShareLayout />}> | ||
<Route path={"/"} element={<HomePage />} /> | ||
<Route path={"/anime"} element={<AnimePage />} /> | ||
<Route path={"/anime/:animeID"} element={<AnimeDetailPage />} /> | ||
<Route path={"/character/"} element={<CharacterPage />} /> | ||
<Route | ||
path={"/character/:characterID"} | ||
element={<CharacterDetailPage />} | ||
/> | ||
<Route path={"/search"} element={<SearchPage />} /> | ||
</Route> | ||
|
||
<Route path={"*"} element={<Error404Page />} /> | ||
</Routes> | ||
<ToastContainer | ||
position="top-right" | ||
autoClose={2000} | ||
hideProgressBar={false} | ||
closeOnClick | ||
rtl={false} | ||
pauseOnFocusLoss | ||
draggable | ||
pauseOnHover={false} | ||
/> | ||
</Suspense> | ||
</BrowserRouter> | ||
</QueryClientProvider>, | ||
document.getElementById("root") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
883c78d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
anime-website-react – ./
anime-website-react-sonicname.vercel.app
anime-website-react.vercel.app
anime-website-react-git-master-sonicname.vercel.app