- Improved development environment

This commit is contained in:
2025-10-13 13:58:10 +01:00
parent 6ab10341b4
commit 9334154603
2 changed files with 7 additions and 4 deletions

View File

@@ -4,8 +4,10 @@ import type { CameraBlackBoardOptions } from "../types/types";
import { useEffect } from "react";
import { toast } from "sonner";
const camBase = import.meta.env.MODE !== "development" ? CAM_BASE : "";
const getAllBlackboardData = async () => {
const response = await fetch(`${CAM_BASE}/api/blackboard`, {
const response = await fetch(`${camBase}/api/blackboard`, {
signal: AbortSignal.timeout(500),
});
if (!response.ok) {
@@ -15,7 +17,7 @@ const getAllBlackboardData = async () => {
};
const viewBlackboardData = async (options: CameraBlackBoardOptions) => {
const response = await fetch(`${CAM_BASE}/api/blackboard`, {
const response = await fetch(`/${camBase}api/blackboard`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(options),

View File

@@ -1,4 +1,5 @@
const rawCamBase = import.meta.env.VITE_AGX_BOX_URL;
export const CAM_BASE = rawCamBase ? rawCamBase : window.location.origin;
const environment = import.meta.env.MODE;
export const OUTSIDE_CAM_BASE = import.meta.env.VITE_OUTSIDE_BASEURL;
export const CAM_BASE =
environment === "development" ? rawCamBase : window.location.origin;