Spaces:
Running
Running
axeronis commited on
Commit ·
9bf36ba
1
Parent(s): 92eacc4
fix: Replace relative API paths with full backend URL in ClientCard
Browse files- Fix /api/v1/playbook/stages to use NEXT_PUBLIC_API_URL
- Fix /api/v1/leads/{id}/analyze to use NEXT_PUBLIC_API_URL
- Resolves 404/405 errors from calling Vercel instead of Railway backend
- All API calls now correctly route to Railway backend
frontend/components/ClientCard.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
|
|
| 31 |
|
| 32 |
useEffect(() => {
|
| 33 |
if (!lead.current_stage_id) return
|
| 34 |
-
fetch(`/api/v1/playbook/stages`, {
|
| 35 |
headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}` }
|
| 36 |
})
|
| 37 |
.then(r => r.ok ? r.json() : [])
|
|
@@ -45,7 +45,7 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
|
|
| 45 |
const handleReanalyze = async () => {
|
| 46 |
setIsReanalyzing(true)
|
| 47 |
try {
|
| 48 |
-
const res = await fetch(`/api/v1/leads/${lead.id}/analyze`, {
|
| 49 |
method: 'POST',
|
| 50 |
headers: {
|
| 51 |
'Content-Type': 'application/json',
|
|
@@ -61,6 +61,7 @@ export function ClientCard({ lead, onTakeover, isAnalyzing, onRefresh, conversat
|
|
| 61 |
setIsReanalyzing(false)
|
| 62 |
}
|
| 63 |
}
|
|
|
|
| 64 |
// Helper to clean values
|
| 65 |
const cleanValue = (value: any, fallback: string): string => {
|
| 66 |
if (!value || typeof value !== 'string') return fallback
|
|
|
|
| 31 |
|
| 32 |
useEffect(() => {
|
| 33 |
if (!lead.current_stage_id) return
|
| 34 |
+
fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/playbook/stages`, {
|
| 35 |
headers: { 'Authorization': `Bearer ${localStorage.getItem('auth_token')}` }
|
| 36 |
})
|
| 37 |
.then(r => r.ok ? r.json() : [])
|
|
|
|
| 45 |
const handleReanalyze = async () => {
|
| 46 |
setIsReanalyzing(true)
|
| 47 |
try {
|
| 48 |
+
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/v1/leads/${lead.id}/analyze`, {
|
| 49 |
method: 'POST',
|
| 50 |
headers: {
|
| 51 |
'Content-Type': 'application/json',
|
|
|
|
| 61 |
setIsReanalyzing(false)
|
| 62 |
}
|
| 63 |
}
|
| 64 |
+
|
| 65 |
// Helper to clean values
|
| 66 |
const cleanValue = (value: any, fallback: string): string => {
|
| 67 |
if (!value || typeof value !== 'string') return fallback
|