aboutsummaryrefslogtreecommitdiff
path: root/pages/api/v2/source
diff options
context:
space:
mode:
Diffstat (limited to 'pages/api/v2/source')
-rw-r--r--pages/api/v2/source/index.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/pages/api/v2/source/index.js b/pages/api/v2/source/index.js
index f15e47d..9ec6082 100644
--- a/pages/api/v2/source/index.js
+++ b/pages/api/v2/source/index.js
@@ -1,7 +1,11 @@
import { rateLimiterRedis, redis } from "@/lib/redis";
import axios from "axios";
-const CONSUMET_URI = process.env.API_URI;
+let CONSUMET_URI;
+CONSUMET_URI = process.env.API_URI;
+if (CONSUMET_URI.endsWith("/")) {
+ CONSUMET_URI = CONSUMET_URI.slice(0, -1);
+}
const API_KEY = process.env.API_KEY;
async function consumetSource(id) {
@@ -25,7 +29,7 @@ async function anifySource(providerId, watchId, episode, id, sub) {
);
return data;
} catch (error) {
- return null;
+ return { error: error.message, status: error.response.status };
}
}