25 lines
709 B
JavaScript
25 lines
709 B
JavaScript
import React from 'react'
|
|
import SearchBar from './SearchBar'
|
|
import axios from 'axios'
|
|
|
|
class App extends React.Component {
|
|
async onSearchSubmit(term) {
|
|
const response = await axios.get("https://api.unsplash.com/search/photos", {
|
|
params: { query: term },
|
|
headers: {
|
|
Authorization: 'Client-ID b4d9ccd8113d1f68079b8eb43747bfe5e56705409be3ed9e1db0accbc3da35ce'
|
|
}
|
|
})
|
|
console.log(response.data.results)
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="ui container" style={{ marginTop: "10px" }}>
|
|
<SearchBar onSubmit={this.onSearchSubmit} />
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default App; |