mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-28 17:09:41 +05:00
refactor: change API proxy from Serverless Functions to Serverless Middlewares to save Function Invocations on vercel
This commit is contained in:
parent
11343eb7f8
commit
ad1c56f593
9 changed files with 81 additions and 60 deletions
|
@ -1,12 +1,12 @@
|
|||
"use client";
|
||||
import { useUserStore } from "#/store/auth";
|
||||
import { useEffect, useState } from "react";
|
||||
import { fetchDataViaGet } from "../api/utils";
|
||||
import { Spinner } from "../components/Spinner/Spinner";
|
||||
import { Avatar, Card, Button, Table } from "flowbite-react";
|
||||
import { Chip } from "../components/Chip/Chip";
|
||||
import { unixToDate, minutesToTime } from "../api/utils";
|
||||
import { fetchDataViaGet, unixToDate, minutesToTime } from "../api/utils";
|
||||
import { ReleaseCourusel } from "#/components/ReleaseCourusel/ReleaseCourusel";
|
||||
import { ENDPOINTS } from "#/api/config";
|
||||
|
||||
export const ProfilePage = (props: any) => {
|
||||
const authUser = useUserStore((state) => state);
|
||||
|
@ -15,7 +15,7 @@ export const ProfilePage = (props: any) => {
|
|||
|
||||
useEffect(() => {
|
||||
async function _getData() {
|
||||
let url = `/api/profile/${props.id}`;
|
||||
let url = `${ENDPOINTS.user.profile}/${props.id}`;
|
||||
if (authUser.token) {
|
||||
url += `?token=${authUser.token}`;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import { ReleaseInfoRelated } from "#/components/ReleaseInfo/ReleaseInfo.Related
|
|||
import { ReleaseInfoScreenshots } from "#/components/ReleaseInfo/ReleaseInfo.Screenshots";
|
||||
import { CommentsMain } from "#/components/Comments/Comments.Main";
|
||||
import { InfoLists } from "#/components/InfoLists/InfoLists";
|
||||
import { ENDPOINTS } from "#/api/config";
|
||||
|
||||
export const ReleasePage = (props: any) => {
|
||||
const userStore = useUserStore();
|
||||
|
@ -25,7 +26,7 @@ export const ReleasePage = (props: any) => {
|
|||
function useFetch(id: number) {
|
||||
let url: string;
|
||||
|
||||
url = `/api/release/${id}`;
|
||||
url = `${ENDPOINTS.release.info}/${id}`;
|
||||
if (userStore.token) {
|
||||
url += `?token=${userStore.token}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue