fix: add missing cors and content-type headers

This commit is contained in:
Kentai Radiquum 2025-07-08 18:34:59 +05:00
parent 51c5bf01da
commit cc9a9c3a2c
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
14 changed files with 116 additions and 89 deletions

View file

@ -2,7 +2,7 @@ export const CURRENT_APP_VERSION = "3.7.0";
import { env } from "next-runtime-env";
const NEXT_PUBLIC_API_URL = env("NEXT_PUBLIC_API_URL") || null;
export const API_URL = "https://api.anixart.app";
export const API_URL = NEXT_PUBLIC_API_URL ||"https://api.anixart.app";
export const API_PREFIX = NEXT_PUBLIC_API_URL || "/api/proxy";
export const USER_AGENT =
"AnixartApp/9.0 BETA 5-25062213 (Android 9; SDK 28; arm64-v8a; samsung SM-G975N; en)";

View file

@ -323,6 +323,7 @@ export async function _FetchHomePageReleases(
const data: Object = fetch(url, {
method: "POST",
headers: HEADERS,
body: JSON.stringify(body),
})
.then((response) => {

View file

@ -42,6 +42,7 @@ export const CommentsAddModal = (props: {
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
});

View file

@ -32,6 +32,7 @@ export const CommentsEditModal = (props: {
}
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(data),
});

View file

@ -1,6 +1,13 @@
"use client";
import { FileInput, Label, Modal, ModalBody, ModalHeader, useThemeMode } from "flowbite-react";
import {
FileInput,
Label,
Modal,
ModalBody,
ModalHeader,
useThemeMode,
} from "flowbite-react";
import { Spinner } from "../Spinner/Spinner";
import useSWR from "swr";
import { ENDPOINTS } from "#/api/config";
@ -143,6 +150,7 @@ export const ProfileEditModal = (props: {
const { data, error } = await tryCatchAPI(
fetch(`${ENDPOINTS.user.settings.avatar}?token=${props.token}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: formData,
})
);
@ -188,7 +196,7 @@ export const ProfileEditModal = (props: {
if (avatarModalProps.croppedImage) {
_uploadAvatar();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [avatarModalProps.croppedImage]);
if (!prefData || !loginData || prefError || loginError) {

View file

@ -188,6 +188,7 @@ export const CreateCollectionPage = () => {
const { data, error } = await tryCatchAPI(
fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
...collectionInfo,
is_private: isPrivate,