migrate genre type
This commit is contained in:
@@ -117,7 +117,7 @@ const useStyles = (inLibrary: string) => makeStyles((theme: Theme) => ({
|
||||
}));
|
||||
|
||||
interface IProps{
|
||||
manga: IManga
|
||||
manga: IAnime
|
||||
}
|
||||
|
||||
function getSourceName(source: ISource) {
|
||||
|
||||
@@ -247,7 +247,7 @@ export default function MangaDetails(props: IProps) {
|
||||
<p>{manga.description}</p>
|
||||
</div>
|
||||
<div className={classes.genre}>
|
||||
{manga.genre?.split(', ').map((g) => <h5 key={g}>{g}</h5>)}
|
||||
{manga.genre.map((g) => <h5 key={g}>{g}</h5>)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@ export default function Anime() {
|
||||
|
||||
const { id } = useParams<{ id: string }>();
|
||||
|
||||
const [manga, setManga] = useState<IManga>();
|
||||
const [manga, setManga] = useState<IAnime>();
|
||||
const [episodes, setEpisodes] = useState<IEpisode[]>([]);
|
||||
const [fetchedEpisodes, setFetchedEpisodes] = useState(false);
|
||||
const [noEpisodesFound, setNoEpisodesFound] = useState(false);
|
||||
@@ -63,7 +63,7 @@ export default function Anime() {
|
||||
if (manga === undefined || !manga.freshData) {
|
||||
client.get(`/api/v1/anime/anime/${id}/?onlineFetch=${manga !== undefined}`)
|
||||
.then((response) => response.data)
|
||||
.then((data: IManga) => {
|
||||
.then((data: IAnime) => {
|
||||
setManga(data);
|
||||
setTitle(data.title);
|
||||
});
|
||||
|
||||
@@ -63,7 +63,7 @@ export default function AnimeSearchSingle() {
|
||||
if (searchTerm.length > 0) {
|
||||
client.get(`/api/v1/anime/source/${sourceId}/search/${searchTerm}/${lastPageNum}`)
|
||||
.then((response) => response.data)
|
||||
.then((data: { mangaList: IManga[], hasNextPage: boolean }) => {
|
||||
.then((data: { mangaList: IAnime[], hasNextPage: boolean }) => {
|
||||
setMessage('');
|
||||
if (data.mangaList.length > 0) {
|
||||
setMangas([
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function Player() {
|
||||
setTitle('Reader');
|
||||
client.get(`/api/v1/anime/anime/${animeId}/`)
|
||||
.then((response) => response.data)
|
||||
.then((data: IManga) => {
|
||||
.then((data: IAnime) => {
|
||||
setTitle(data.title);
|
||||
});
|
||||
}, [episodeIndex]);
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function SourceAnimes(props: { popular: boolean }) {
|
||||
const sourceType = props.popular ? 'popular' : 'latest';
|
||||
client.get(`/api/v1/anime/source/${sourceId}/${sourceType}/${lastPageNum}`)
|
||||
.then((response) => response.data)
|
||||
.then((data: { mangaList: IManga[], hasNextPage: boolean }) => {
|
||||
.then((data: { mangaList: IAnime[], hasNextPage: boolean }) => {
|
||||
setMangas([
|
||||
...mangas,
|
||||
...data.mangaList.map((it) => ({
|
||||
|
||||
22
src/typings.d.ts
vendored
22
src/typings.d.ts
vendored
@@ -44,6 +44,28 @@ interface IManga {
|
||||
title: string
|
||||
thumbnailUrl: string
|
||||
|
||||
artist: string
|
||||
author: string
|
||||
description: string
|
||||
genre: string[]
|
||||
status: string
|
||||
|
||||
inLibrary: boolean
|
||||
source: ISource
|
||||
|
||||
realUrl: string
|
||||
|
||||
freshData: boolean
|
||||
}
|
||||
|
||||
interface IAnime {
|
||||
id: number
|
||||
sourceId: string
|
||||
|
||||
url: string
|
||||
title: string
|
||||
thumbnailUrl: string
|
||||
|
||||
artist: string
|
||||
author: string
|
||||
description: string
|
||||
|
||||
Reference in New Issue
Block a user