From e4f0743e2f76f82df1d65988dd61c9da9063fd94 Mon Sep 17 00:00:00 2001 From: icarus Date: Thu, 18 Sep 2025 20:47:53 +0800 Subject: [PATCH] fix(api): replace Axios constructor with axios.create for better defaults Using axios.create() provides better default configuration and error handling compared to the Axios constructor --- src/renderer/src/api/agent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/api/agent.ts b/src/renderer/src/api/agent.ts index 06820321fe..4847ff99ec 100644 --- a/src/renderer/src/api/agent.ts +++ b/src/renderer/src/api/agent.ts @@ -15,7 +15,7 @@ import { UpdateAgentResponse, UpdateAgentResponseSchema } from '@types' -import { Axios, AxiosRequestConfig, isAxiosError } from 'axios' +import axios, { Axios, AxiosRequestConfig, isAxiosError } from 'axios' import { ZodError } from 'zod' type ApiVersion = 'v1' @@ -46,7 +46,7 @@ export class AgentApiClient { if (config.baseURL.endsWith('/')) { throw new Error('baseURL should not end with /') } - this.axios = new Axios(config) + this.axios = axios.create(config) if (apiVersion) { this.apiVersion = apiVersion }