refactor: use apiUrl

This commit is contained in:
karishmas6
2024-11-01 08:25:14 +05:30
parent bb38786027
commit ba9e046576
6 changed files with 36 additions and 30 deletions

View File

@@ -1,8 +1,9 @@
import { default as axios } from "axios";
import { apiUrl } from "../apiConfig";
export const sendProxyConfig = async (proxyConfig: { server_url: string, username?: string, password?: string }): Promise<boolean> => {
try {
const response = await axios.post(`http://localhost:8080/proxy/config`, proxyConfig);
const response = await axios.post(`${apiUrl}/proxy/config`, proxyConfig);
if (response.status === 200) {
return response.data;
} else {
@@ -16,7 +17,7 @@ export const sendProxyConfig = async (proxyConfig: { server_url: string, usernam
export const getProxyConfig = async (): Promise<{ proxy_url: string, auth: boolean }> => {
try {
const response = await axios.get(`http://localhost:8080/proxy/config`);
const response = await axios.get(`${apiUrl}/proxy/config`);
if (response.status === 200) {
return response.data;
} else {
@@ -30,7 +31,7 @@ export const getProxyConfig = async (): Promise<{ proxy_url: string, auth: boole
export const testProxyConfig = async (): Promise<{ success: boolean }> => {
try {
const response = await axios.get(`http://localhost:8080/proxy/test`);
const response = await axios.get(`${apiUrl}/proxy/test`);
if (response.status === 200) {
return response.data;
} else {
@@ -44,7 +45,7 @@ export const testProxyConfig = async (): Promise<{ success: boolean }> => {
export const deleteProxyConfig = async (): Promise<boolean> => {
try {
const response = await axios.delete(`http://localhost:8080/proxy/config`);
const response = await axios.delete(`${apiUrl}/proxy/config`);
if (response.status === 200) {
return response.data;
} else {