- updated base for endpoints
- added loading states - need to add new form for ftp type
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import type { BearerTypeFields } from "../../../types/types";
|
||||
import { CAMBASE } from "../../../utils/config";
|
||||
|
||||
const fetchBearerConfig = async (bearerConfig: string) => {
|
||||
const response = await fetch(`http://100.115.148.59/api/fetch-config?id=Dispatcher0-${bearerConfig}`, {
|
||||
const response = await fetch(`${CAMBASE}/api/fetch-config?id=Dispatcher0-${bearerConfig}`, {
|
||||
method: "GET",
|
||||
});
|
||||
if (!response.ok) {
|
||||
@@ -37,7 +38,7 @@ const postBearerConfig = async (config: BearerTypeFields) => {
|
||||
},
|
||||
],
|
||||
};
|
||||
const response = await fetch("http://192.168.202.121/api/update-config", {
|
||||
const response = await fetch(`${CAMBASE}/api/update-config`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(channelConfigPayload),
|
||||
});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useQuery, useMutation } from "@tanstack/react-query";
|
||||
import type { DispatcherConfig } from "../../../types/types";
|
||||
import { CAMBASE } from "../../../utils/config";
|
||||
|
||||
const getDispatcherConfig = async () => {
|
||||
const response = await fetch(`http://192.168.202.121/api/fetch-config?id=Dispatcher0`);
|
||||
const response = await fetch(`${CAMBASE}/api/fetch-config?id=Dispatcher0`);
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
@@ -23,7 +24,7 @@ const postDispatcherConfig = async (config: DispatcherConfig) => {
|
||||
},
|
||||
],
|
||||
};
|
||||
const response = await fetch(`http://192.168.202.121/api/update-config`, {
|
||||
const response = await fetch(`${CAMBASE}/api/update-config`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(updateConfigPayload),
|
||||
});
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useQuery, useMutation } from "@tanstack/react-query";
|
||||
import type { OptionalBOF2Constants } from "../../../types/types";
|
||||
import { CAMBASE } from "../../../utils/config";
|
||||
|
||||
const fetchOptionalConstants = async (format: string) => {
|
||||
if (!format || format === "json") return null;
|
||||
const response = await fetch(`http://100.115.148.59/api/fetch-config?id=Dispatcher0-${format}-constants`);
|
||||
const response = await fetch(`${CAMBASE}/api/fetch-config?id=Dispatcher0-${format}-constants`);
|
||||
if (!response.ok) {
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
@@ -37,7 +38,7 @@ const postOptionalConstants = async (config: OptionalBOF2Constants) => {
|
||||
fields: fields,
|
||||
};
|
||||
|
||||
const response = await fetch(`http://100.115.148.59/api/update-config`, {
|
||||
const response = await fetch(`${CAMBASE}/api/update-config`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(updateConfigPayload),
|
||||
});
|
||||
Reference in New Issue
Block a user