Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove axios dependency (#16959)

boojackdd95a98d2010
diff --git a/frontend/package.json b/frontend/package.json
index 104f0fdc23..6c45c8ae37 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -30,7 +30,6 @@
"@soerenmartius/vue3-clipboard": "0.1.2",
"@tanstack/vue-table": "8.21.3",
"@vueuse/core": "12.8.2",
- "axios": "1.9.0",
"bootstrap": "5.3.6",
"crypto-js": "^4.2.0",
"d3-shape": "^3.2.0",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 2f82fef399..696613d84a 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -52,9 +52,6 @@ importers:
'@vueuse/core':
specifier: 12.8.2
version: 12.8.2([email protected])
- axios:
- specifier: 1.9.0
- version: 1.9.0
bootstrap:
specifier: 5.3.6
version: 5.3.6(@popperjs/[email protected])
@@ -2761,9 +2758,6 @@ packages:
peerDependencies:
postcss: ^8.1.0
- resolution: {integrity: sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==}
-
resolution: {integrity: sha512-3sX/eOms8kd3q2KZ6DAhKPc0dgm525Gqq5NtWKZ7QYYZEv57OQ54KtblzJzH1lQF/eQxO8KjWGIK9IPUJNus5g==}
peerDependencies:
@@ -3478,15 +3472,6 @@ packages:
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
- resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==}
- engines: {node: '>=4.0'}
- peerDependencies:
- debug: '*'
- peerDependenciesMeta:
- debug:
- optional: true
-
resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==}
engines: {node: '>=14'}
@@ -4440,9 +4425,6 @@ packages:
resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==}
- resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
-
resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==}
@@ -8802,14 +8784,6 @@ snapshots:
postcss: 8.5.4
postcss-value-parser: 4.2.0
- dependencies:
- follow-redirects: 1.15.9
- form-data: 4.0.2
- proxy-from-env: 1.1.0
- transitivePeerDependencies:
- - debug
-
dependencies:
'@babel/compat-data': 7.27.3
@@ -9576,8 +9550,6 @@ snapshots:
-
dependencies:
cross-spawn: 7.0.6
@@ -10725,8 +10697,6 @@ snapshots:
-
diff --git a/frontend/src/axios.ts b/frontend/src/axios.ts
deleted file mode 100644
index 02e6432e50..0000000000
--- a/frontend/src/axios.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import axios from "axios";
-import { isSilent } from "./plugins/silent-request";
-import { pushNotification } from "./store";
-import { isDev } from "./utils";
-
-axios.defaults.timeout = 30000;
-axios.interceptors.request.use((request) => {
- if (isDev() && request.url!.startsWith("/api")) {
- console.debug(
- request.method?.toUpperCase() + " " + request.url + " request",
- JSON.stringify(request, null, 2)
- );
- }
-
- return request;
-});
-
-axios.interceptors.response.use(
- (response) => {
- if (isDev() && response.config.url!.startsWith("/api")) {
- console.debug(
- response.config.method?.toUpperCase() +
- " " +
- response.config.url +
- " response",
- JSON.stringify(response.data, null, 2)
- );
- }
- return response;
- },
- async (error) => {
- if (error.response) {
- if (error.response.data?.message && !isSilent()) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: error.response.data.message,
- // If server enables --debug, then the response will include the detailed error.
- description: error.response.data.error
- ? error.response.data.error
- : undefined,
- });
- }
- } else if (error.code == "ECONNABORTED" && !isSilent()) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Connecting server timeout. Make sure the server is running.",
- });
- }
-
- throw error;
- }
-);
diff --git a/frontend/src/main.ts b/frontend/src/main.ts
index 07f07190ce..b6a8c4e55e 100644
--- a/frontend/src/main.ts
+++ b/frontend/src/main.ts
@@ -4,7 +4,6 @@ import App from "./App.vue";
import "./assets/css/github-markdown-style.css";
import "./assets/css/inter.css";
import "./assets/css/tailwind.css";
-import "./axios";
import dayjs from "./plugins/dayjs";
import highlight from "./plugins/highlight";
import i18n from "./plugins/i18n";
diff --git a/frontend/src/store/modules/v1/actuator.ts b/frontend/src/store/modules/v1/actuator.ts
index b928a86157..d5a44773af 100644
--- a/frontend/src/store/modules/v1/actuator.ts
+++ b/frontend/src/store/modules/v1/actuator.ts
@@ -1,7 +1,6 @@
import { create } from "@bufbuild/protobuf";
import type { RemovableRef } from "@vueuse/core";
import { useLocalStorage } from "@vueuse/core";
-import axios from "axios";
import { defineStore } from "pinia";
import semver from "semver";
import { computed } from "vue";
@@ -241,9 +240,15 @@ export const useActuatorV1Store = defineStore("actuator_v1", {
},
async fetchLatestRelease(): Promise<Release | undefined> {
try {
- const { data: releaseList } = await useSilentRequest(() =>
- axios.get<Release[]>(`${GITHUB_API_LIST_BYTEBASE_RELEASE}?per_page=1`)
- );
+ const releaseList = await useSilentRequest(async () => {
+ const response = await fetch(
+ `${GITHUB_API_LIST_BYTEBASE_RELEASE}?per_page=1`
+ );
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+ return response.json() as Promise<Release[]>;
+ });
return releaseList[0];
} catch {
// It's okay to ignore the failure and just return undefined.
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index e71073364f..f9f7acb2b6 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -72,11 +72,7 @@ export default defineConfig({
return "ui-framework";
}
// Utilities
- if (
- id.includes("lodash") ||
- id.includes("dayjs") ||
- id.includes("axios")
- ) {
+ if (id.includes("lodash") || id.includes("dayjs")) {
return "utils";
}
},