pages api done

This commit is contained in:
Aria Moradi
2021-01-20 00:04:12 +03:30
parent 21c0ea4e90
commit 5d9173d3f7
12 changed files with 128 additions and 33 deletions
+4 -3
View File
@@ -39,6 +39,8 @@ export default function ChapterCard(props: IProps) {
const classes = useStyles();
const { chapter } = props;
const dateStr = chapter.date_upload && new Date(chapter.date_upload).toISOString().slice(0, 10);
return (
<>
<li>
@@ -53,13 +55,12 @@ export default function ChapterCard(props: IProps) {
<Typography variant="caption" display="block" gutterBottom>
{chapter.scanlator}
{chapter.scanlator && ' '}
{chapter.date_upload
&& new Date(chapter.date_upload).toISOString().slice(0, 10)}
{dateStr}
</Typography>
</div>
</div>
<div style={{ display: 'flex' }}>
<Button variant="outlined" style={{ marginLeft: 20 }} onClick={() => { /* window.location.href = 'sources/popular/'; */ }}>open</Button>
<Button variant="outlined" style={{ marginLeft: 20 }} onClick={() => { window.location.href = `http://127.0.0.1:4567/api/v1/chapter/${chapter.id}`; }}>open</Button>
</div>
</CardContent>
</Card>
+1 -1
View File
@@ -16,7 +16,7 @@ export default function Manga() {
}, []);
useEffect(() => {
fetch(`http://127.0.0.1:4567/api/v1/chapters/${id}/`)
fetch(`http://127.0.0.1:4567/api/v1/manga/${id}/chapters`)
.then((response) => response.json())
.then((data) => setChapters(data));
}, []);
+3 -1
View File
@@ -23,9 +23,11 @@ interface IManga {
}
interface IChapter {
id: number
url: string
name: string
date_upload: string
date_upload: number
chapter_number: number
scanlator: String
mangaId: number
}