fixed redirectUri and added search on enter press

This commit is contained in:
Tutic 2022-12-09 15:29:39 +01:00
parent d2bcd32dd2
commit fddf1ed6b1
4 changed files with 10 additions and 3 deletions

2
package-lock.json generated
View File

@ -13,7 +13,7 @@
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-scripts": "5.0.1", "react-scripts": "^5.0.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
} }
}, },

View File

@ -8,7 +8,7 @@
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-scripts": "5.0.1", "react-scripts": "^5.0.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
"scripts": { "scripts": {

View File

@ -15,12 +15,19 @@ class SearchBar extends React.Component {
handleTermChange = (event) => { handleTermChange = (event) => {
this.setState({ term: event.target.value }); this.setState({ term: event.target.value });
}; };
handleKeyDown = event => {
if (event.key === "Enter"){
this.search()
}
}
render() { render() {
return ( return (
<div className="SearchBar"> <div className="SearchBar">
<input <input
placeholder="Enter A Song, Album, or Artist" placeholder="Enter A Song, Album, or Artist"
onChange={this.handleTermChange} onChange={this.handleTermChange}
onKeyDown={this.handleKeyDown}
/> />
<button className="SearchButton" onClick={this.search}> <button className="SearchButton" onClick={this.search}>
SEARCH SEARCH

View File

@ -1,6 +1,6 @@
const clientId = "c39c93bbf05745fb986d1e566004eb31"; const clientId = "c39c93bbf05745fb986d1e566004eb31";
// Hosted on https://jammingcademy.surge.sh/, but save playlist does not work // Hosted on https://jammingcademy.surge.sh/, but save playlist does not work
const redirectUri = "http://localhost:3000/"; const redirectUri = "http://localhost:3000";
let accessToken = ""; let accessToken = "";
export const Spotify = { export const Spotify = {