Some tweaks

This commit is contained in:
cdricms
2026-03-21 11:53:25 +01:00
parent 4cf85981eb
commit 83eddf89cd
5 changed files with 22 additions and 32 deletions

View File

@@ -1,6 +1,7 @@
"use client";
import { API_URL } from "@/lib/constants";
import { ApiResponse } from "@/types/types";
import { getApiUrl } from "@/utils/api";
import { getCookie } from "cookies-next";
import { useState, useRef, useCallback } from "react";
@@ -24,7 +25,7 @@ const useFileUpload = (): UseFileUploadReturn => {
const uploadFile = useCallback(
(file: File, url: string, onSuccess?: (response: any) => void) => {
url = `${API_URL}${url}`;
url = `${getApiUrl()}${url}`;
if (!file || !url) {
setError("File and upload URL are required.");
return;
@@ -35,7 +36,7 @@ const useFileUpload = (): UseFileUploadReturn => {
return;
}
fetch(`${API_URL}/media/verify`, {
fetch(`${getApiUrl()}/media/verify`, {
method: "POST",
body: JSON.stringify({
name: file.name,