feat(api): generate API models and hooks for public shop configuration and commerce entities
- Added generated API hooks and models for public shop configuration, including listing and retrieving configurations. - Introduced models for commerce categories, discount codes, orders, product images, and products with pagination and search parameters. - Ensured all generated files are structured for easy integration with React Query.
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
import axios, { type AxiosRequestConfig } from "axios";
|
||||
|
||||
const backendUrl = import.meta.env.VITE_BACKEND_URL || "http://localhost:8000";
|
||||
|
||||
|
||||
// použij tohle pro API vyžadující autentizaci
|
||||
export const privateApi = axios.create({
|
||||
baseURL: backendUrl,
|
||||
withCredentials: true, // potřebuje HttpOnly cookies
|
||||
});
|
||||
|
||||
// Set baseURL at runtime (using Function to hide from orval's esbuild)
|
||||
try {
|
||||
const getEnv = new Function('return import.meta.env.VITE_BACKEND_URL');
|
||||
privateApi.defaults.baseURL = getEnv() || "http://localhost:8000";
|
||||
} catch {
|
||||
privateApi.defaults.baseURL = "http://localhost:8000";
|
||||
}
|
||||
|
||||
privateApi.interceptors.response.use(
|
||||
(res) => res,
|
||||
async (error) => {
|
||||
|
||||
Reference in New Issue
Block a user