diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 224d814..70733a0 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,6 +1,6 @@ upstream backend { server 100.66.170.15:8080; - server 127.0.0.1:5218; + server 127.0.0.1:8080; server 172.18.10.8:8080; } server { @@ -25,7 +25,7 @@ server { } location /api/ { - proxy_pass http://backend/; + proxy_pass http://100.66.170.15:8080; # Cho phép upload file lớn (vd: 200MB) client_max_body_size 200M; diff --git a/package-lock.json b/package-lock.json index c22c2f2..f86addf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -129,6 +129,7 @@ "version": "7.28.0", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz", "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -658,6 +659,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" }, @@ -681,6 +683,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" } @@ -3254,6 +3257,7 @@ "version": "1.129.8", "resolved": "https://registry.npmjs.org/@tanstack/react-router/-/react-router-1.129.8.tgz", "integrity": "sha512-d5mfM+67h3wq7aHkLjRKXD1ddbzx1YuxaEbNvW45jjZXMgaikZSVfJrZBiUWXE/nhV1sTdbMQ48JcPagvGPmYQ==", + "peer": true, "dependencies": { "@tanstack/history": "1.129.7", "@tanstack/react-store": "^0.7.0", @@ -3334,6 +3338,7 @@ "version": "1.129.8", "resolved": "https://registry.npmjs.org/@tanstack/router-core/-/router-core-1.129.8.tgz", "integrity": "sha512-Izqf5q8TzJv0DJURynitJioPJT3dPAefrzHi2wlY/Q5+7nEG41SkjYMotTX2Q9i/Pjl91lW8gERCHpksszRdRw==", + "peer": true, "dependencies": { "@tanstack/history": "1.129.7", "@tanstack/store": "^0.7.0", @@ -3539,6 +3544,7 @@ "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -3691,6 +3697,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "devOptional": true, + "peer": true, "dependencies": { "undici-types": "~7.8.0" } @@ -3701,6 +3708,7 @@ "integrity": "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -3711,6 +3719,7 @@ "integrity": "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw==", "devOptional": true, "license": "MIT", + "peer": true, "peerDependencies": { "@types/react": "^19.0.0" } @@ -4152,6 +4161,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", @@ -4591,7 +4601,8 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "peer": true }, "node_modules/data-uri-to-buffer": { "version": "4.0.1", @@ -4987,6 +4998,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "peer": true, "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.0", @@ -5718,6 +5730,7 @@ "integrity": "sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "cssstyle": "^4.2.1", "data-urls": "^5.0.0", @@ -6801,6 +6814,7 @@ "version": "19.1.0", "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -6809,6 +6823,7 @@ "version": "19.1.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", + "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -7191,6 +7206,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/seroval/-/seroval-1.3.2.tgz", "integrity": "sha512-RbcPH1n5cfwKrru7v7+zrZvjLurgHhGyso3HTyGtRivGWgYjbOmGuivCQaORNELjNONoK35nj28EoWul9sb1zQ==", + "peer": true, "engines": { "node": ">=10" } @@ -7649,7 +7665,8 @@ "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", - "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==" + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "peer": true }, "node_modules/tiny-warning": { "version": "1.0.3", @@ -7705,6 +7722,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -7892,6 +7910,7 @@ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8072,6 +8091,7 @@ "version": "6.4.1", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", @@ -8183,6 +8203,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -8516,6 +8537,7 @@ "version": "3.25.76", "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/src/layouts/app-layout.tsx b/src/layouts/app-layout.tsx index 03576ea..7a33b1e 100644 --- a/src/layouts/app-layout.tsx +++ b/src/layouts/app-layout.tsx @@ -8,7 +8,7 @@ import { import { Home, Building, AppWindow, Terminal, CircleX } from "lucide-react"; import { Toaster } from "@/components/ui/sonner"; import { useQueryClient } from "@tanstack/react-query"; -import { API_ENDPOINTS, BASE_URL } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { Separator } from "@/components/ui/separator"; type AppLayoutProps = { @@ -22,7 +22,7 @@ export default function AppLayout({ children }: AppLayoutProps) { queryClient.prefetchQuery({ queryKey: ["agent-version"], queryFn: () => - fetch(BASE_URL + API_ENDPOINTS.APP_VERSION.GET_VERSION).then((res) => + fetch(API_ENDPOINTS.APP_VERSION.GET_VERSION).then((res) => res.json() ), staleTime: 60 * 1000, @@ -32,7 +32,7 @@ export default function AppLayout({ children }: AppLayoutProps) { queryClient.prefetchQuery({ queryKey: ["software-version"], queryFn: () => - fetch(BASE_URL + API_ENDPOINTS.APP_VERSION.GET_SOFTWARE).then((res) => + fetch(API_ENDPOINTS.APP_VERSION.GET_SOFTWARE).then((res) => res.json() ), staleTime: 60 * 1000, @@ -43,7 +43,7 @@ export default function AppLayout({ children }: AppLayoutProps) { queryClient.prefetchQuery({ queryKey: ["room-list"], queryFn: () => - fetch(BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST).then((res) => + fetch(API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST).then((res) => res.json() ), staleTime: 60 * 1000, @@ -54,7 +54,7 @@ export default function AppLayout({ children }: AppLayoutProps) { queryClient.prefetchQuery({ queryKey: ["blacklist"], queryFn: () => - fetch(BASE_URL + API_ENDPOINTS.APP_VERSION).then((res) => + fetch(API_ENDPOINTS.APP_VERSION + "").then((res) => res.json() ), staleTime: 60 * 1000, diff --git a/src/routes/_authenticated/agent/index.tsx b/src/routes/_authenticated/agent/index.tsx index a062101..00cb6c8 100644 --- a/src/routes/_authenticated/agent/index.tsx +++ b/src/routes/_authenticated/agent/index.tsx @@ -2,7 +2,7 @@ import { createFileRoute } from "@tanstack/react-router"; import { AppManagerTemplate } from "@/template/app-manager-template"; import { useQueryData } from "@/hooks/useQueryData"; import { useMutationData } from "@/hooks/useMutationData"; -import { BASE_URL, API_ENDPOINTS } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { toast } from "sonner"; import type { ColumnDef } from "@tanstack/react-table"; import type { AxiosProgressEvent } from "axios"; @@ -17,13 +17,13 @@ function AgentsPage() { // Lấy danh sách version const { data, isLoading } = useQueryData({ queryKey: ["agent-version"], - url: BASE_URL + API_ENDPOINTS.APP_VERSION.GET_VERSION, + url: API_ENDPOINTS.APP_VERSION.GET_VERSION, }); // Lấy danh sách phòng const { data: roomData } = useQueryData({ queryKey: ["rooms"], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, + url: API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, }); const versionList: Version[] = Array.isArray(data) @@ -33,7 +33,7 @@ function AgentsPage() { : []; const uploadMutation = useMutationData({ - url: BASE_URL + API_ENDPOINTS.APP_VERSION.UPLOAD, + url: API_ENDPOINTS.APP_VERSION.UPLOAD, method: "POST", invalidate: [["agent-version"]], onSuccess: () => toast.success("Upload thành công!"), @@ -67,7 +67,7 @@ function AgentsPage() { try { for (const roomName of roomNames) { await updateMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.UPDATE_AGENT(roomName), + url: API_ENDPOINTS.DEVICE_COMM.UPDATE_AGENT(roomName), method: "POST", data: undefined }); diff --git a/src/routes/_authenticated/apps/index.tsx b/src/routes/_authenticated/apps/index.tsx index 152f176..76487fa 100644 --- a/src/routes/_authenticated/apps/index.tsx +++ b/src/routes/_authenticated/apps/index.tsx @@ -2,7 +2,7 @@ import { createFileRoute } from "@tanstack/react-router"; import { AppManagerTemplate } from "@/template/app-manager-template"; import { useQueryData } from "@/hooks/useQueryData"; import { useMutationData } from "@/hooks/useMutationData"; -import { BASE_URL, API_ENDPOINTS } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { toast } from "sonner"; import type { ColumnDef } from "@tanstack/react-table"; import { useState } from "react"; @@ -18,12 +18,12 @@ export const Route = createFileRoute("/_authenticated/apps/")({ function AppsComponent() { const { data, isLoading } = useQueryData({ queryKey: ["software-version"], - url: BASE_URL + API_ENDPOINTS.APP_VERSION.GET_SOFTWARE, + url: API_ENDPOINTS.APP_VERSION.GET_SOFTWARE, }); const { data: roomData } = useQueryData({ queryKey: ["rooms"], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, + url: API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, }); const versionList: Version[] = Array.isArray(data) @@ -35,7 +35,7 @@ function AppsComponent() { const [table, setTable] = useState(); const uploadMutation = useMutationData({ - url: BASE_URL + API_ENDPOINTS.APP_VERSION.UPLOAD, + url: API_ENDPOINTS.APP_VERSION.UPLOAD, method: "POST", invalidate: [["software-version"]], onSuccess: () => toast.success("Upload thành công!"), @@ -66,7 +66,7 @@ function AppsComponent() { }); const deleteMutation = useMutationData<{ MsiFileIds: number[] }>({ - url: BASE_URL + API_ENDPOINTS.APP_VERSION.DELETE_FILES, + url: API_ENDPOINTS.APP_VERSION.DELETE_FILES + "", method: "POST", invalidate: [["software-version"]], onSuccess: () => toast.success("Xóa phần mềm thành công!"), @@ -80,7 +80,7 @@ function AppsComponent() { fileName: string; version: string; }>({ - url: BASE_URL + API_ENDPOINTS.APP_VERSION.ADD_REQUIRED_FILE, + url: API_ENDPOINTS.APP_VERSION.ADD_REQUIRED_FILE, method: "POST", invalidate: [["software-version"]], onSuccess: () => toast.success("Thêm file vào danh sách thành công!"), @@ -187,7 +187,7 @@ function AppsComponent() { try { for (const roomName of roomNames) { await installMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.INSTALL_MSI(roomName), + url: API_ENDPOINTS.DEVICE_COMM.INSTALL_MSI(roomName), data: { MsiFileIds }, }); } @@ -214,7 +214,7 @@ function AppsComponent() { try { for (const roomName of roomNames) { await downloadMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.DOWNLOAD_FILES(roomName), + url: API_ENDPOINTS.DEVICE_COMM.DOWNLOAD_FILES(roomName), data: { MsiFileIds }, }); } @@ -247,7 +247,7 @@ function AppsComponent() { const { id } = row.original; await deleteRequiredFileMutation.mutateAsync({ data: { id }, - url: BASE_URL + API_ENDPOINTS.APP_VERSION.DELETE_REQUIRED_FILE(id), + url: API_ENDPOINTS.APP_VERSION.DELETE_REQUIRED_FILE(id), }); } if (table) { @@ -269,7 +269,7 @@ function AppsComponent() { const { id } = row.original; await deleteMutation.mutateAsync({ data: { MsiFileIds: [id] }, - url: BASE_URL + API_ENDPOINTS.APP_VERSION.DELETE_FILES(id), + url: API_ENDPOINTS.APP_VERSION.DELETE_FILES(id), }); } if (table) { diff --git a/src/routes/_authenticated/blacklist/index.tsx b/src/routes/_authenticated/blacklist/index.tsx index 56306d6..c6a3f9a 100644 --- a/src/routes/_authenticated/blacklist/index.tsx +++ b/src/routes/_authenticated/blacklist/index.tsx @@ -1,4 +1,4 @@ -import { API_ENDPOINTS, BASE_URL } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { useMutationData } from "@/hooks/useMutationData"; import { useDeleteData } from "@/hooks/useDeleteData"; import { useQueryData } from "@/hooks/useQueryData"; @@ -20,13 +20,13 @@ function BlacklistComponent() { // Lấy danh sách blacklist const { data, isLoading } = useQueryData({ queryKey: ["blacklist"], - url: BASE_URL + API_ENDPOINTS.APP_VERSION.GET_VERSION, + url: API_ENDPOINTS.APP_VERSION.GET_VERSION, }); // Lấy danh sách phòng const { data: roomData } = useQueryData({ queryKey: ["rooms"], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, + url: API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, }); const blacklist: Blacklist[] = Array.isArray(data) @@ -127,7 +127,7 @@ function BlacklistComponent() { }) => { try { await addNewBlacklistMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.APP_VERSION.ADD_BLACKLIST, + url: API_ENDPOINTS.APP_VERSION.ADD_BLACKLIST, method: "POST", config: { headers: { "Content-Type": "application/json" } }, data: undefined, @@ -143,7 +143,7 @@ function BlacklistComponent() { for (const blacklistId of selectedRows) { await deleteBlacklistMutation.mutateAsync({ url: - BASE_URL + API_ENDPOINTS.APP_VERSION.DELETE_BLACKLIST(blacklistId), + API_ENDPOINTS.APP_VERSION.DELETE_BLACKLIST(blacklistId), config: { headers: { "Content-Type": "application/json" } }, }); } @@ -156,7 +156,7 @@ function BlacklistComponent() { try { for (const deviceId of targets) { await updateDeviceMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.UPDATE_BLACKLIST(deviceId), + url: API_ENDPOINTS.DEVICE_COMM.UPDATE_BLACKLIST(deviceId), data: undefined, }); toast.success(`Đã gửi cập nhật cho ${deviceId}`); diff --git a/src/routes/_authenticated/command/index.tsx b/src/routes/_authenticated/command/index.tsx index 686a9e4..62374a9 100644 --- a/src/routes/_authenticated/command/index.tsx +++ b/src/routes/_authenticated/command/index.tsx @@ -3,7 +3,7 @@ import { FormSubmitTemplate } from "@/template/form-submit-template"; import { ShellCommandForm } from "@/components/forms/command-form"; import { useMutationData } from "@/hooks/useMutationData"; import { useQueryData } from "@/hooks/useQueryData"; -import { BASE_URL, API_ENDPOINTS } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { toast } from "sonner"; type SendCommandRequest = { Command: string }; @@ -18,7 +18,7 @@ function CommandPage() { // Lấy danh sách phòng từ API const { data: roomData } = useQueryData({ queryKey: ["rooms"], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, + url: API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, }); // Mutation gửi lệnh @@ -49,7 +49,7 @@ function CommandPage() { rooms={roomData} onSubmit={(roomName, command) => { sendCommandMutation.mutateAsync({ - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.SEND_COMMAND(roomName), + url: API_ENDPOINTS.DEVICE_COMM.SEND_COMMAND(roomName), data: { Command: command }, }); }} diff --git a/src/routes/_authenticated/room/$roomName/index.tsx b/src/routes/_authenticated/room/$roomName/index.tsx index a09eef2..3b07d6a 100644 --- a/src/routes/_authenticated/room/$roomName/index.tsx +++ b/src/routes/_authenticated/room/$roomName/index.tsx @@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button"; import { useQueryData } from "@/hooks/useQueryData"; import { useDeviceEvents } from "@/hooks/useDeviceEvents"; import { useClientFolderStatus } from "@/hooks/useClientFolderStatus"; -import { API_ENDPOINTS, BASE_URL } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { DeviceGrid } from "@/components/grids/device-grid"; import { DeviceTable } from "@/components/tables/device-table"; import { useMachineNumber } from "@/hooks/useMachineNumber"; @@ -32,7 +32,7 @@ function RoomDetailPage() { const { data: devices = [] } = useQueryData({ queryKey: ["devices", roomName], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_DEVICE_FROM_ROOM(roomName), + url: API_ENDPOINTS.DEVICE_COMM.GET_DEVICE_FROM_ROOM(roomName), }); const parseMachineNumber = useMachineNumber(); @@ -41,7 +41,7 @@ function RoomDetailPage() { try { setIsCheckingFolder(true); const response = await fetch( - BASE_URL + API_ENDPOINTS.DEVICE_COMM.REQUEST_GET_CLIENT_FOLDER_STATUS(roomName), + API_ENDPOINTS.DEVICE_COMM.REQUEST_GET_CLIENT_FOLDER_STATUS(roomName), { method: "POST", } diff --git a/src/routes/_authenticated/room/index.tsx b/src/routes/_authenticated/room/index.tsx index 4feafb8..30702d5 100644 --- a/src/routes/_authenticated/room/index.tsx +++ b/src/routes/_authenticated/room/index.tsx @@ -1,4 +1,4 @@ -import { API_ENDPOINTS, BASE_URL } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import { useQueryData } from "@/hooks/useQueryData"; import { useDeviceEvents } from "@/hooks/useDeviceEvents"; import { createFileRoute, useNavigate } from "@tanstack/react-router"; @@ -44,7 +44,7 @@ function RoomComponent() { const { data: roomData = [], isLoading } = useQueryData({ queryKey: ["rooms"], - url: BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, + url: API_ENDPOINTS.DEVICE_COMM.GET_ROOM_LIST, }); const [sorting, setSorting] = React.useState([]); diff --git a/src/services/device.service.ts b/src/services/device.service.ts index 2266a13..d60cbbc 100644 --- a/src/services/device.service.ts +++ b/src/services/device.service.ts @@ -1,6 +1,6 @@ import axios from "axios"; import { queryClient } from "@/main"; -import { BASE_URL, API_ENDPOINTS } from "@/config/api"; +import { API_ENDPOINTS } from "@/config/api"; import type { DeviceHealthCheck } from "@/types/device"; export async function fetchDevicesFromRoom( @@ -10,7 +10,7 @@ export async function fetchDevicesFromRoom( queryKey: ["devices-from-room", roomName], queryFn: async () => { const response = await axios.get( - BASE_URL + API_ENDPOINTS.DEVICE_COMM.GET_DEVICE_FROM_ROOM(roomName) + API_ENDPOINTS.DEVICE_COMM.GET_DEVICE_FROM_ROOM(roomName) ); return response.data ?? []; },