[1.0.0] #19
@@ -22,3 +22,8 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
#env files
|
||||
.env
|
||||
.env.*.local
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import axios from "axios";
|
||||
import type {InternalAxiosRequestConfig} from "axios";
|
||||
|
||||
const BASE_URL: string = "http://localhost:3000/api";
|
||||
const baseURL: string = import.meta.env.VITE_API_URL;
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: BASE_URL,
|
||||
baseURL: baseURL,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
|
||||
@@ -14,6 +14,7 @@ export function BytescaleUploader({
|
||||
onChange,
|
||||
folderPath,
|
||||
}: BytescaleUploaderProps) {
|
||||
const baseURL = import.meta.env.VITE_API_URL;
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -33,15 +34,11 @@ export function BytescaleUploader({
|
||||
formData.append("folderPath", folderPath);
|
||||
|
||||
try {
|
||||
const response = await axios.post(
|
||||
"http://localhost:3000/api/upload",
|
||||
formData,
|
||||
{
|
||||
const response = await axios.post(`${baseURL}/upload`, formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const {fileUrl} = response.data;
|
||||
onChange(fileUrl);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: "http://localhost:3000/api",
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
});
|
||||
|
||||
api.interceptors.request.use((config) => {
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
Reference in New Issue
Block a user