fix(app): ensure api baseURL resolves properly during SSR build
Deploy Canina / deploy (push) Successful in 2m50s

This commit is contained in:
parsa aghaei committed 2026-08-16 13:06:50 +03:30
1 parent b161ecf815
commit 5c13dd2f29
1 file changed
+9 -1
+9 -1
View File
@@ -2,7 +2,15 @@ import axios from 'axios';
import { toast } from 'sonner';
import { useUserStore } from '../store/userStore';
const baseURL = process.env.NEXT_PUBLIC_API_URL || (process.env.NODE_ENV === 'development' ? 'http://localhost:4001/api' : '/api');
const getBaseURL = () => {
if (process.env.NEXT_PUBLIC_API_URL) return process.env.NEXT_PUBLIC_API_URL;
if (typeof window === 'undefined') {
return 'http://127.0.0.1:4001/api';
}
return process.env.NODE_ENV === 'development' ? 'http://localhost:4001/api' : '/api';
};
const baseURL = getBaseURL();
export interface ApiErrorPayload {
success: boolean;