fix: use NEXT_PUBLIC_API_URL env var for API requests

This commit is contained in:
Tiago Yamamoto 2025-12-23 23:50:56 -03:00
parent 6bb90bdd1c
commit b7987dead9
2 changed files with 9 additions and 17 deletions

View file

@ -1,29 +1,20 @@
# =============================================================================
# GoHorse Jobs Frontend - Environment Variables Example
# GoHorse Jobs Frontend - Environment Variables
# =============================================================================
# Copy this file to .env.local and update the values
# API Backend URL
# IMPORTANT: Include /api/v1 suffix
# Local development:
NEXT_PUBLIC_API_URL=http://localhost:8521/api/v1
# API Backend URL (just the domain, endpoints already include /api/v1)
# Examples:
# Local development: http://localhost:8521
# Production: https://api.gohorsejobs.com
# Production:
# NEXT_PUBLIC_API_URL=https://api-dev.gohorsejobs.com/api/v1
NEXT_PUBLIC_API_URL=http://localhost:8521
# Seeder API URL (for admin operations)
NEXT_PUBLIC_SEEDER_API_URL=http://localhost:3001
# Production:
# NEXT_PUBLIC_SEEDER_API_URL=https://seeder-dev.gohorsejobs.com
# Scraper API URL (for importing scraped jobs)
NEXT_PUBLIC_SCRAPER_API_URL=http://localhost:3002
# Production:
# NEXT_PUBLIC_SCRAPER_API_URL=https://scraper-dev.gohorsejobs.com
# Vercel Analytics (optional)
NEXT_PUBLIC_VERCEL_ANALYTICS=false

View file

@ -1,8 +1,9 @@
import { toast } from "sonner";
import { Job } from "./types";
// const API_BASE_URL = "http://localhost:8521"; // Backend URL // Use this for dev
const API_BASE_URL = ""; // Use this for production/setup with proxy
// API Base URL - endpoints already include /api/v1 prefix
// NEXT_PUBLIC_API_URL should be just the domain, e.g. https://api.gohorsejobs.com
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "";
/**
* Helper to log CRUD actions for the 'Activity Log' or console