New Home page, New UI, Proxy api requests through next.js api routes

This commit is contained in:
Kentai Radiquum 2024-07-11 07:33:56 +05:00
parent 49b9ac069f
commit a30ddcfc6a
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
20 changed files with 5385 additions and 0 deletions

42
app/api/home/route.js Normal file
View file

@ -0,0 +1,42 @@
import { NextResponse } from "next/server";
import { fetchDataViaPost } from "../utils";
import { ENDPOINTS } from "../config";
export async function GET(request) {
const page = parseInt(request.nextUrl.searchParams.get(["page"])) || 0;
const status = request.nextUrl.searchParams.get(["status"]) || null;
let statusId;
if (status == "last" || !status) {
statusId = null;
} else if (status == "finished") {
statusId = 1;
} else if (status == "ongoing") {
statusId = 2;
} else if (status == "announce") {
statusId = 3;
}
const data = {
country: null,
season: null,
sort: 0,
studio: null,
age_ratings: [],
category_id: null,
end_year: null,
episode_duration_from: null,
episode_duration_to: null,
episodes_from: null,
episodes_to: null,
genres: [],
profile_list_exclusions: [],
start_year: null,
status_id: statusId,
types: [],
is_genres_exclude_mode_enabled: false,
};
const response = await fetchDataViaPost(`${ENDPOINTS.filter}/${page}`, data);
return NextResponse.json(response);
}