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",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"react-scripts": "^5.0.1",
"web-vitals": "^2.1.4"
}
},

View File

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

View File

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

View File

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