mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
rewrite some fetch methods to use the useAxios hook
This commit is contained in:
@@ -40,6 +40,7 @@ def get_albums():
|
||||
def get_album():
|
||||
"""Returns all the tracks in the given album."""
|
||||
data = request.get_json()
|
||||
print(data)
|
||||
album, artist = data["album"], data["artist"]
|
||||
albumhash = helpers.create_album_hash(album, artist)
|
||||
|
||||
@@ -47,6 +48,10 @@ def get_album():
|
||||
tracks = [models.Track(t) for t in tracks]
|
||||
|
||||
album = instances.album_instance.find_album_by_hash(albumhash)
|
||||
|
||||
if not album:
|
||||
return {"error": "Album not found."}, 404
|
||||
|
||||
album = models.Album(album)
|
||||
|
||||
album.count = len(tracks)
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.lib import playlistlib
|
||||
from flask import Blueprint
|
||||
from flask import request
|
||||
|
||||
from app.helpers import UseBisection, create_new_date
|
||||
from app.helpers import Get, UseBisection, create_new_date
|
||||
|
||||
playlist_bp = Blueprint("playlist", __name__, url_prefix="/")
|
||||
|
||||
@@ -104,7 +104,9 @@ def update_playlist(playlistid: str):
|
||||
"thumb": None,
|
||||
}
|
||||
|
||||
p = UseBisection(api.PLAYLISTS, "playlistid", [playlistid])()
|
||||
playlists = Get.get_all_playlists()
|
||||
|
||||
p = UseBisection(playlists, "playlistid", [playlistid])()
|
||||
p: models.Playlist = p[0]
|
||||
|
||||
if playlist is not None:
|
||||
|
||||
Reference in New Issue
Block a user