story writer backend migration complete, Blog writer SEO and story writer backend migration complete, Blog writer SEO and story writer frontend migration complete
This commit is contained in:
@@ -43,7 +43,7 @@ export const setAuthTokenGetter = (getter: () => Promise<string | null>) => {
|
||||
};
|
||||
|
||||
// Get API URL from environment variables
|
||||
const getApiUrl = () => {
|
||||
export const getApiUrl = () => {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// In production, use the environment variable or fallback
|
||||
return process.env.REACT_APP_API_URL || process.env.REACT_APP_BACKEND_URL;
|
||||
@@ -52,8 +52,10 @@ const getApiUrl = () => {
|
||||
};
|
||||
|
||||
// Create a shared axios instance for all API calls
|
||||
const apiBaseUrl = getApiUrl();
|
||||
|
||||
export const apiClient = axios.create({
|
||||
baseURL: getApiUrl(),
|
||||
baseURL: apiBaseUrl,
|
||||
timeout: 60000, // Increased to 60 seconds for regular API calls
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -62,7 +64,7 @@ export const apiClient = axios.create({
|
||||
|
||||
// Create a specialized client for AI operations with extended timeout
|
||||
export const aiApiClient = axios.create({
|
||||
baseURL: getApiUrl(),
|
||||
baseURL: apiBaseUrl,
|
||||
timeout: 180000, // 3 minutes timeout for AI operations (matching 20-25 second responses)
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -71,7 +73,7 @@ export const aiApiClient = axios.create({
|
||||
|
||||
// Create a specialized client for long-running operations like SEO analysis
|
||||
export const longRunningApiClient = axios.create({
|
||||
baseURL: getApiUrl(),
|
||||
baseURL: apiBaseUrl,
|
||||
timeout: 300000, // 5 minutes timeout for SEO analysis
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -80,7 +82,7 @@ export const longRunningApiClient = axios.create({
|
||||
|
||||
// Create a specialized client for polling operations with reasonable timeout
|
||||
export const pollingApiClient = axios.create({
|
||||
baseURL: getApiUrl(),
|
||||
baseURL: apiBaseUrl,
|
||||
timeout: 60000, // 60 seconds timeout for polling status checks
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user