Il codice sopra è ok, ma nella prossima versione gli errori di axios vengono gestiti nel `then()` lasciando cosi al `catch()` i bug del codice javascript:
In questo oggetto andiamo a definire particolari tipi di configurazione.
Nelle righe dove c'è `//default` li abbiamo dei parametri predefiniti che permettono gia ad axios di funzionare, possono essere sovrascritti nell'oggetto che passiamo ad axios.
Di norma le uniche proprietà che andremo a definire nell'oggetto saranno `params: {}` e `data:{}` rispettivamente per GET e POST.
L'API key è `AIzaSyBbuSz5f4wzfVJzHZpDv_UJcM8WZYH4YmE` Può essere trovata nel file `apikey`.
---
[Youtube api reference](https://developers.google.com/youtube/v3/docs/)
- [/videos api reference](https://developers.google.com/youtube/v3/docs/videos/list)
- - [Api explorer for /videos](https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list)
- [/commentThreads api reference](https://developers.google.com/youtube/v3/docs/commentThreads/list)
- - [Api explorer for /commentThreads](https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.commentThreads.list)
In `/videos` la durata del video è in formato [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) con i moduli `moment` e `moment-duration-format` possiamo convertilo in formato minuti:secondi (`mm:ss`)
|###|###|
|---|---|
|contentDetails.duration| The length of the video. The property value is an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). For example, for a video that is at least one minute long and less than one hour long, the duration is in the format PT#M#S, in which the letters PT indicate that the value specifies a period of time, and the letters M and S refer to length in minutes and seconds, respectively. The # characters preceding the M and S letters are both integers that specify the number of minutes (or seconds) of the video. For example, a value of PT15M33S indicates that the video is 15 minutes and 33 seconds long. If the video is at least one hour long, the duration is in the format PT#H#M#S, in which the # preceding the letter H specifies the length of the video in hours and all of the other details are the same as described above. If the video is at least one day long, the letters P and T are separated, and the value's format is P#DT#H#M#S. Please refer to the ISO 8601 specification for complete details. |
Il css di bootstrap va importato una volta sola nel componente che racchiude tutta la logica dell'applicazione, infatti qui è importato solamente in `App.js`.
For convenience it is also possible to access the PlayerState constants through react-youtube:
`YouTube.PlayerState` contains the values that are used by the [YouTube IFrame Player API](https://developers.google.com/youtube/iframe_api_reference#onStateChange).