Skip to content

Commit

Permalink
add log to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jugurtha Bouhadoun committed Oct 30, 2024
1 parent 88a026f commit 0be53a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/api/certificat/[idAdresse]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export async function GET(request: NextRequest, { params }: { params: { idAdress

const { banId: addressID } = address
console.log(`${NEXT_PUBLIC_API_BAN_URL}/api/certificate/`)
console.log(JSON.stringify({ addressID }))
console.log(`Token ${BAN_API_TOKEN}`)
const response = await fetch(`${NEXT_PUBLIC_API_BAN_URL}/api/certificate/`, {
method: 'POST',
headers: {
Expand All @@ -56,9 +58,12 @@ export async function GET(request: NextRequest, { params }: { params: { idAdress
},
body: JSON.stringify({ addressID }),
})
console.log(response)

if (!response.ok) {
throw new Error('Échec de la publication des données')
const errorMessage = `Erreur ${response.status}: ${response.statusText}`
console.error('Échec de la publication des données :', errorMessage)
throw new Error(errorMessage)
}

const data = await response.json()
Expand Down

0 comments on commit 0be53a5

Please sign in to comment.