From 2389d9a36f24d3cac42e561fbe11743da0c051d6 Mon Sep 17 00:00:00 2001 From: A i j a Z <72906651+Aijazmakerb@users.noreply.github.com> Date: Sun, 22 Oct 2023 20:44:11 +0530 Subject: [PATCH] fixed redis (#94) * fixed schedules * fixed redis --- pages/api/v2/episode/[id].js | 2 +- pages/api/v2/etc/schedule/index.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pages/api/v2/episode/[id].js b/pages/api/v2/episode/[id].js index 3f1372b8..b86a1983 100644 --- a/pages/api/v2/episode/[id].js +++ b/pages/api/v2/episode/[id].js @@ -238,7 +238,7 @@ export default async function handler(req, res) { if (meta) { data = await appendMetaToEpisodes(filteredData, JSON.parse(meta)); } else if (cover && !cover.some((e) => e.img === null)) { - await redis.set(`meta:${id}`, JSON.stringify(cover)); + if (redis) await redis.set(`meta:${id}`, JSON.stringify(cover)); data = await appendMetaToEpisodes(filteredData, cover); } diff --git a/pages/api/v2/etc/schedule/index.js b/pages/api/v2/etc/schedule/index.js index 9b8f43d9..2ddc82a2 100644 --- a/pages/api/v2/etc/schedule/index.js +++ b/pages/api/v2/etc/schedule/index.js @@ -2,13 +2,11 @@ import axios from "axios"; import cron from "cron"; import { rateLimiterRedis, redis } from "@/lib/redis"; -const API_KEY = process.env.API_KEY; - // Function to fetch new data async function fetchData() { try { const { data } = await axios.get( - `https://api.anify.tv/schedule?apikey=${API_KEY}` + `https://api.anify.tv/schedule?fields=[id,coverImage,title,bannerImage]` ); return data; } catch (error) {