Skip to content

Commit

Permalink
fix unused ref
Browse files Browse the repository at this point in the history
  • Loading branch information
MaGOs92 committed Dec 8, 2023
1 parent f9304fa commit f8bcee0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ NEXT_PUBLIC_GHOST_URL_IMAGES_SOURCE=ghost.adresse.data.gouv.fr
NEXT_PUBLIC_BAL_ADMIN_API_URL=https://bal-admin.adresse.data.gouv.fr/api
NEXT_PUBLIC_BAL_API_URL=https://api-bal.adresse.data.gouv.fr/v1
NEXT_PUBLIC_MES_ADRESSES=https://mes-adresses.data.gouv.fr
NEXT_PUBLIC_BAL_WIDGET_URL=http://localhost:3003
NEXT_PUBLIC_BAL_WIDGET_URL=https://plateforme-bal.adresse.data.gouv.fr/bal-widget
15 changes: 5 additions & 10 deletions hooks/bal-widget.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import {useEffect, useRef} from 'react'

const BAL_WIDGET_URL = process.env.NEXT_PUBLIC_BAL_WIDGET_URL
import {useEffect} from 'react'

export function useBALWidget() {
const balWidgetRootElement = useRef(null)

useEffect(() => {

Check failure on line 4 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 2 spaces but found 4.
if (!process.env.NEXT_PUBLIC_BAL_WIDGET_URL) {

Check failure on line 5 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 4 spaces but found 8.
return

Check failure on line 6 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 6 spaces but found 12.
}

Check failure on line 7 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 4 spaces but found 8.
const script = document.createElement('script')

Check failure on line 8 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 4 spaces but found 8.

Check failure on line 8 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected blank line before this statement.
script.src = `${BAL_WIDGET_URL}/bal-widget.js`
script.src = `${process.env.NEXT_PUBLIC_BAL_WIDGET_URL}/bal-widget.js`

Check failure on line 9 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 4 spaces but found 8.
script.async = true

Check failure on line 10 in hooks/bal-widget.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Expected indentation of 4 spaces but found 8.
script.defer = true
document.body.appendChild(script)

script.onload = () => {
balWidgetRootElement.current = document.getElementById('bal-widget')
}

return () => {
document.body.removeChild(script)
}
Expand Down
1 change: 0 additions & 1 deletion pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useBALWidget } from '@/hooks/bal-widget'
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID


const {
withDsfr,
dsfrDocumentApi
Expand Down

0 comments on commit f8bcee0

Please sign in to comment.