feat: add favorites page

This commit is contained in:
Kentai Radiquum 2024-07-16 13:08:43 +05:00
parent 484148ada6
commit 28efc5a98c
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
10 changed files with 177 additions and 36 deletions

View file

@ -1,6 +1,7 @@
import { NextResponse } from "next/server";
import { fetchDataViaGet } from "../utils";
import { ENDPOINTS } from "../config";
import { sort } from "../common";
const list = {
watching: 1,
@ -10,20 +11,12 @@ const list = {
abandoned: 5,
};
const sort = {
adding_descending: 1,
adding_ascending: 2,
// year_descending: 3,
// year_ascending: 4,
alphabet_descending: 5,
alphabet_ascending: 6,
};
export async function GET(request) {
const page = parseInt(request.nextUrl.searchParams.get(["page"])) || 0;
const listName = request.nextUrl.searchParams.get(["list"]) || null;
const token = request.nextUrl.searchParams.get(["token"]) || null;
const sortName = request.nextUrl.searchParams.get(["sort"]) || "adding_descending";
const sortName =
request.nextUrl.searchParams.get(["sort"]) || "adding_descending";
if (!token || token == "null") {
return NextResponse.json({ message: "No token provided" }, { status: 403 });