ALwrity + Wordpress + Wix + GSC integration

This commit is contained in:
ajaysi
2025-10-08 14:25:59 +05:30
parent 3bab3450dc
commit 5e3901c1c6
22 changed files with 2284 additions and 1222 deletions

View File

@@ -7,9 +7,17 @@ export const setAuthTokenGetter = (getter: () => Promise<string | null>) => {
authTokenGetter = getter;
};
// Create a shared axios instance for all API calls (same-origin; CRA proxy forwards to backend)
// Get API URL from environment variables
const getApiUrl = () => {
if (process.env.NODE_ENV === 'production') {
return process.env.REACT_APP_API_URL || 'https://your-backend-url.railway.app';
}
return ''; // Use proxy in development
};
// Create a shared axios instance for all API calls
export const apiClient = axios.create({
baseURL: '',
baseURL: getApiUrl(),
timeout: 60000, // Increased to 60 seconds for regular API calls
headers: {
'Content-Type': 'application/json',
@@ -18,7 +26,7 @@ export const apiClient = axios.create({
// Create a specialized client for AI operations with extended timeout
export const aiApiClient = axios.create({
baseURL: '',
baseURL: getApiUrl(),
timeout: 180000, // 3 minutes timeout for AI operations (matching 20-25 second responses)
headers: {
'Content-Type': 'application/json',
@@ -27,7 +35,7 @@ export const aiApiClient = axios.create({
// Create a specialized client for long-running operations like SEO analysis
export const longRunningApiClient = axios.create({
baseURL: '',
baseURL: getApiUrl(),
timeout: 300000, // 5 minutes timeout for SEO analysis
headers: {
'Content-Type': 'application/json',
@@ -36,7 +44,7 @@ export const longRunningApiClient = axios.create({
// Create a specialized client for polling operations with reasonable timeout
export const pollingApiClient = axios.create({
baseURL: '',
baseURL: getApiUrl(),
timeout: 60000, // 60 seconds timeout for polling status checks
headers: {
'Content-Type': 'application/json',