aboutsummaryrefslogtreecommitdiff
path: root/pages/en
diff options
context:
space:
mode:
Diffstat (limited to 'pages/en')
-rw-r--r--pages/en/manga/[...id].js25
1 files changed, 14 insertions, 11 deletions
diff --git a/pages/en/manga/[...id].js b/pages/en/manga/[...id].js
index 106bce2..6d2b016 100644
--- a/pages/en/manga/[...id].js
+++ b/pages/en/manga/[...id].js
@@ -347,14 +347,14 @@ export async function getServerSideProps(context) {
},
};
} else {
- const getCached = await redis.get(`mangaPage:${mangadexId}`);
+ if (redis) {
+ const getCached = await redis.get(`mangaPage:${mangadexId}`);
- if (getCached) {
- cached = JSON.parse(getCached);
+ if (getCached) {
+ cached = JSON.parse(getCached);
+ }
}
-
// let chapters;
-
if (cached) {
data = cached.data;
info = cached.info;
@@ -389,12 +389,15 @@ export async function getServerSideProps(context) {
color: textColor,
};
- await redis.set(
- `mangaPage:${mangadexId}`,
- JSON.stringify({ data, info, color }),
- "ex",
- 60 * 60 * 24
- );
+ if(redis)
+ {
+ await redis.set(
+ `mangaPage:${mangadexId}`,
+ JSON.stringify({ data, info, color }),
+ "ex",
+ 60 * 60 * 24
+ );
+ }
}
}