Merge remote-tracking branch 'origin/master'

This commit is contained in:
2026-02-14 10:40:23 +03:00
parent 76fa2040b1
commit 7b0850eb4e

View File

@@ -3,9 +3,8 @@ import axios from 'axios'
import qs from 'qs'
import { useAuthStore } from 'stores/authStore'
// ✅ Vite uyumlu env okuma
export const API_BASE_URL =
import.meta.env.VITE_API_BASE_URL || '/api'
// 🔥 ENV YOK
export const API_BASE_URL = '/api'
const api = axios.create({
baseURL: API_BASE_URL,
@@ -15,9 +14,6 @@ const api = axios.create({
withCredentials: true
})
/* ============================
REQUEST INTERCEPTOR
============================ */
api.interceptors.request.use((config) => {
const auth = useAuthStore()
const url = config.url || ''
@@ -36,9 +32,6 @@ api.interceptors.request.use((config) => {
return config
})
/* ============================
RESPONSE INTERCEPTOR
============================ */
let isLoggingOut = false
api.interceptors.response.use(
@@ -52,15 +45,10 @@ api.interceptors.response.use(
isLoggingOut = false
}
}
return Promise.reject(error)
}
)
/* ============================
HELPERS
============================ */
export const get = (u, p = {}, c = {}) =>
api.get(u, { params: p, ...c }).then(r => r.data)
@@ -74,10 +62,7 @@ export const del = (u, p = {}, c = {}) =>
api.delete(u, { params: p, ...c }).then(r => r.data)
export const download = (u, p = {}, c = {}) =>
api.get(u, {
params: p,
responseType: 'blob',
...c
}).then(r => r.data)
api.get(u, { params: p, responseType: 'blob', ...c })
.then(r => r.data)
export default api