fix: correct SQL parameter index and improve API URL handling

- Fixed SQL UPDATE query parameter mismatch ($4 → $3) in Homebrew package fetcher
- Enhanced API_BASE_URL configuration to handle empty strings and trailing slashes, defaulting to '/api' for relative paths
This commit is contained in:
Yusuf İpek
2025-11-11 18:50:33 +03:00
parent 0b01191193
commit 87f28e4da9
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
import { Platform, Package, FilterOptions } from '@/types'
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3002/api'
const API_BASE_URL = (process.env.NEXT_PUBLIC_API_URL && process.env.NEXT_PUBLIC_API_URL.trim() !== '')
? process.env.NEXT_PUBLIC_API_URL.replace(/\/$/, '')
: '/api'
class ApiClient {
private async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {