This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import * as env from '../.env.json'; | |
const request = axios.create({ | |
baseURL: env.youtubeApiUrl | |
}); | |
export default request; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"youtubeApiUrl": "https://www.googleapis.com/youtube/v3", | |
"youtubeApiKey": "sua_chave_da_api", | |
"vevoChannelId": "UC2pmfLm7iq6Ov1UwYrWYkZA" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import request from './request'; | |
import * as env from '../.env.json'; | |
const getUnsubscribedTrailer = () => request.get(`/channels?key=${env.youtubeApiKey}&part=brandingSettings&id=${env.vevoChannelId}`); | |
export { getUnsubscribedTrailer }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { getUnsubscribedTrailer } from './services/youtubeVideosServices'; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
unsubscribedTrailer: '' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"kind": "youtube#channelListResponse", | |
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/Pjiawp4_6R6R2a8t46glujRUbAU\"", | |
"pageInfo": { | |
"totalResults": 1, | |
"resultsPerPage": 5 | |
}, | |
"items": [ | |
{ | |
"kind": "youtube#channel", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import Welcome from './components/Welcome'; | |
class App extends Component { | |
render() { | |
return ( | |
<> | |
<Welcome /> | |
</> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render() { | |
const username = localStorage.getItem('@welcome-app/username'); | |
if (username !== null) { | |
return ( | |
<div style={styles.container}> | |
<p>Bem vindo {username}</p> | |
<button onClick={this.handleLogout} style={styles.submitButton}>Sair</button> | |
</div> | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleSubmit = (e) => { | |
e.preventDefault(); | |
const username = e.target.elements.username.value; | |
localStorage.setItem('@welcome-app/username', username); | |
window.location.reload(); | |
} | |
handleLogout = () => { | |
localStorage.removeItem('@welcome-app/username'); | |
window.location.reload(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
class Welcome extends Component { | |
handleSubmit = (e) => { | |
e.preventDefault(); | |
const username = e.target.elements.username.value; | |
localStorage.setItem('@welcome-app/username', username); | |
window.location.reload(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = { | |
container: { | |
display: 'flex', | |
textAlign: 'center', | |
flexDirection: 'column', | |
minWidth: '300px', | |
boxShadow: 'rgba(0, 0, 0, 0.1) 0px 0px 20px', | |
background: 'rgb(255, 255, 255)', | |
borderRadius: '4px', | |
padding: '30px 20px' |
OlderNewer