Fix tous les appels API pour utiliser getApiUrl() au lieu de process.env
All checks were successful
Build and Push Docker Images / Build Frontend Image (push) Successful in 3m31s

Problème: Le commit précédent n'avait corrigé que api.ts, mais AudioPlayer
et page.tsx utilisaient encore directement process.env.NEXT_PUBLIC_API_URL,
ce qui ignorait la config runtime.

Fichiers corrigés:
1. lib/api.ts:
   - Export getApiUrl() pour usage externe

2. app/page.tsx:
   - Import getApiUrl
   - /api/library/scan: process.env → getApiUrl()
   - /api/library/scan/status: process.env → getApiUrl()

3. components/AudioPlayer.tsx:
   - Import getApiUrl
   - /api/audio/waveform: process.env → getApiUrl()
   - /api/audio/stream: process.env → getApiUrl()
   - /api/audio/download: process.env → getApiUrl()

Maintenant TOUS les appels API utilisent la config runtime
(window.__RUNTIME_CONFIG__) côté client.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-24 10:54:38 +01:00
parent 36652ea2cc
commit 4d8fa57ab2
3 changed files with 8 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
import { useState, useMemo } from "react"
import { useQuery } from "@tanstack/react-query"
import { getTracks } from "@/lib/api"
import { getTracks, getApiUrl } from "@/lib/api"
import type { FilterParams, Track } from "@/lib/types"
import FilterPanel from "@/components/FilterPanel"
import AudioPlayer from "@/components/AudioPlayer"
@@ -90,7 +90,7 @@ export default function Home() {
setIsScanning(true)
setScanStatus("Démarrage du scan...")
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/library/scan`, {
const response = await fetch(`${getApiUrl()}/api/library/scan`, {
method: 'POST',
})
@@ -103,7 +103,7 @@ export default function Home() {
// Poll scan status
const pollInterval = setInterval(async () => {
try {
const statusResponse = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/library/scan/status`)
const statusResponse = await fetch(`${getApiUrl()}/api/library/scan/status`)
const status = await statusResponse.json()
if (!status.is_scanning) {