mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-20 10:14:18 +01:00
feat: use the api url from device config (#161)
This commit is contained in:
@@ -14,6 +14,7 @@ import { User } from "@/hooks/stores";
|
||||
import { checkAuth } from "@/main";
|
||||
import Fieldset from "@components/Fieldset";
|
||||
import { ChevronLeftIcon } from "@heroicons/react/16/solid";
|
||||
import { CLOUD_API } from "@/ui.config";
|
||||
|
||||
interface LoaderData {
|
||||
device: { id: string; name: string; user: { googleId: string } };
|
||||
@@ -24,7 +25,7 @@ const action = async ({ request }: ActionFunctionArgs) => {
|
||||
const { deviceId } = Object.fromEntries(await request.formData());
|
||||
|
||||
try {
|
||||
const res = await fetch(`${import.meta.env.VITE_CLOUD_API}/devices/${deviceId}`, {
|
||||
const res = await fetch(`${CLOUD_API}/devices/${deviceId}`, {
|
||||
method: "DELETE",
|
||||
credentials: "include",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -46,7 +47,7 @@ const loader = async ({ params }: LoaderFunctionArgs) => {
|
||||
const { id } = params;
|
||||
|
||||
try {
|
||||
const res = await fetch(`${import.meta.env.VITE_CLOUD_API}/devices/${id}`, {
|
||||
const res = await fetch(`${CLOUD_API}/devices/${id}`, {
|
||||
method: "GET",
|
||||
credentials: "include",
|
||||
mode: "cors",
|
||||
|
||||
Reference in New Issue
Block a user