diff --git a/src/pages/comic/[comicId]/chapter/[chapterNumber]/chapter.tsx b/src/pages/comic/[comicId]/chapter/[chapterNumber]/chapter.tsx
index cae0f22a..f04be4fe 100644
--- a/src/pages/comic/[comicId]/chapter/[chapterNumber]/chapter.tsx
+++ b/src/pages/comic/[comicId]/chapter/[chapterNumber]/chapter.tsx
@@ -102,7 +102,16 @@ const Chapter: React.FC = ({
}
}, [comicDetails?.data?.id])
- if (!comicDetails.data || !chapterDetails.data) return null
+ if (comicDetails.loading || chapterDetails.loading) return null
+
+ if ((!comicDetails.data && !comicDetails.loading) || (!chapterDetails.data && !chapterDetails.loading))
+ return (
+
+
+
Error while fetching data!
+
+ )
+
const currentChapIndex = comicDetails?.data?.chapters.findIndex((chap) => chap.id == chapterDetails.data.id)
const mainLanguage = comicDetails.data?.languages?.find((l) => l.isMainLanguage).shortLang
const chapterLocale = chapterDetails.data?.[language] ? language : mainLanguage
@@ -224,8 +233,8 @@ const Chapter: React.FC = ({
+ openComments ? 'h-[calc(100vh-48px)] pb-[52px]' : 'pb-0 h-0'
+ } transition-all w-full fixed bottom-0 bg-[#000000b2]`}>
{chapterComments.data?.length &&
chapterComments.data.map((comment, index) => (
@@ -237,24 +246,28 @@ const Chapter: React.FC = ({
/>
))}
- {account?.verified && account?.name ? (
-
-
-
- ) : (
-
-
- You must{' '}
-
{
- ;(document.querySelector('#open-sign-in-btn') as any)?.click()
- }}>
- sign in
- {' '}
- to comment
+ {openComments ? (
+ account?.verified && account?.name ? (
+
+
-
+ ) : (
+
+
+ You must{' '}
+ {
+ ;(document.querySelector('#open-sign-in-btn') as any)?.click()
+ }}>
+ sign in
+ {' '}
+ to comment
+
+
+ )
+ ) : (
+ <>>
)}
diff --git a/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx b/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
index a9843023..b8783089 100644
--- a/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
+++ b/src/pages/comic/[comicId]/chapter/[chapterNumber]/with-api.tsx
@@ -86,6 +86,10 @@ const withApi = (Component: React.FC) => (props: any) => {
)
const data = cdata[0]
+ if (!data) {
+ return null
+ }
+
const res = {
id: data.id,
views: data.views || 0,
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index c6bc0278..37a4a25d 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -110,7 +110,7 @@ export default function Home() {
/>
-
+
{latestComic.loading
? Array.apply(null, Array(2)).map((d, index) => {
return
@@ -132,7 +132,7 @@ export default function Home() {
Trending
-
+
{trendingComic.loading
? Array.apply(null, Array(2)).map((d, index) => {
return