This commit is contained in:
5t4l1n
2025-07-25 23:58:20 +05:30
parent b70e81d201
commit 4d8061616d
112 changed files with 14445 additions and 59 deletions
+25
View File
@@ -0,0 +1,25 @@
import axios from "axios"
const API_BASE_URL = process.env.NEXT_PUBLIC_BACKEND_URL || "http://127.0.0.1:5000"
const api = axios.create({
baseURL: API_BASE_URL,
headers: {
"Content-Type": "application/json",
},
})
api.interceptors.request.use(
(config) => {
const token = localStorage.getItem("openlearnx_jwt_token")
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
return config
},
(error) => {
return Promise.reject(error)
},
)
export default api