refactor: use apiUrl
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user