feat: add tg api
All checks were successful
Deploy to VPS (dist) / deploy (push) Successful in 1m35s

This commit is contained in:
Hewston Fox
2026-03-16 00:50:53 +02:00
parent 67c2721cff
commit 9f0ff8c4e5
29 changed files with 544 additions and 40 deletions

18
src/api/api.ts Normal file
View File

@@ -0,0 +1,18 @@
import axios from "axios";
import tg, { STORAGE_KEYS } from "@/tg";
const api = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
headers: {
...(import.meta.env.DEV && {
"ngrok-skip-browser-warning": "true",
}),
},
});
api.interceptors.request.use(async (config) => {
config.headers.Authorization = `Bearer ${await tg.storage.getItem(STORAGE_KEYS.authToken)}`;
return config;
});
export default api;