landing api

This commit is contained in:
hamid zarghami
2025-04-14 15:31:57 +03:30
parent 15af39fc84
commit 74c47893dd
25 changed files with 3365 additions and 124 deletions
+24
View File
@@ -0,0 +1,24 @@
import axios from "axios";
import { getToken } from "./func";
// import { Pages } from "./Pages";
const axiosInstance = axios.create({
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
});
axiosInstance.interceptors.response.use(
(response) => response,
(error) => {
return Promise.reject(error);
}
);
axiosInstance.interceptors.request.use(async function (config) {
const tokenValue = await getToken();
const token = tokenValue ? tokenValue : "";
config.headers.Authorization = "Bearer " + token;
return config;
});
export default axiosInstance;