remove fav bro
This commit is contained in:
		
							parent
							
								
									47df0d1adf
								
							
						
					
					
						commit
						b8995d8bca
					
				@ -3,6 +3,18 @@
 | 
				
			|||||||
{% block title %}Favorites!{% endblock %}
 | 
					{% block title %}Favorites!{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block body %}
 | 
					{% block body %}
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					    function rmFromFavs(id) {
 | 
				
			||||||
 | 
					        // alert(id);
 | 
				
			||||||
 | 
					        // /favorite/add/{id}
 | 
				
			||||||
 | 
					        fetch("/favorite/remove/" + id).then((data) => {
 | 
				
			||||||
 | 
					            if (data.status == 200) {
 | 
				
			||||||
 | 
					                document.querySelector("#id" + id).classList.remove("fav");
 | 
				
			||||||
 | 
					                alert("Removed from favs");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
<main id="favorites">
 | 
					<main id="favorites">
 | 
				
			||||||
    <div class="results">
 | 
					    <div class="results">
 | 
				
			||||||
    {% for album_liked in favorites %}
 | 
					    {% for album_liked in favorites %}
 | 
				
			||||||
@ -26,7 +38,9 @@
 | 
				
			|||||||
            {% for track in album_liked["tracklist"] %}
 | 
					            {% for track in album_liked["tracklist"] %}
 | 
				
			||||||
                <p>{{track["title"]}} - {{track["duration"]}}</p>
 | 
					                <p>{{track["title"]}} - {{track["duration"]}}</p>
 | 
				
			||||||
            {% endfor %}
 | 
					            {% endfor %}
 | 
				
			||||||
            <br />
 | 
					            <button onclick="rmFromFavs({{album_liked['id']}})">
 | 
				
			||||||
 | 
					                Remove from favorites
 | 
				
			||||||
 | 
					            </button>
 | 
				
			||||||
        </section>
 | 
					        </section>
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user