- let genres = JSON.parse(lStorage.getItem("genres"))
- if (genres === null) {
- fetch("http://api.brackets.jacobcasper.com/genre")
- .then((response) => response.text())
- .then((text) => {
- window.localStorage.setItem("genres", text);
- genres = JSON.parse(text);
- createGenreList(genreList, genres);
- });
- } else {
- createGenreList(genreList, genres);
+
+ const genres = getGenres(lStorage)
+ .then((genres) => createGenreList(genreList, genres));
+
+ const formSubmitAction = () => {
+ fetch(encodeURI(`http://api.brackets.jacobcasper.com/artist/genre?genre_name=${genreInput.value}`))
+ .then((response) => response.json())
+ .then((data) => drawBracket(canvas, data.slice(0, 33), genreInput.value));