more admin dashboard polish, some code cleanup

This commit is contained in:
ari melody 2025-11-06 22:08:06 +00:00
parent 65f277b3f2
commit a66460be19
Signed by: ari
GPG key ID: CF99829C92678188
23 changed files with 163 additions and 231 deletions

View file

@ -157,7 +157,8 @@ func serveAddCredit(app *model.AppState, release *model.Release) http.Handler {
func serveNewCredit(app *model.AppState) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
artistID := strings.Split(r.URL.Path, "/")[3]
split := strings.Split(r.URL.Path, "/")
artistID := split[len(split) - 1]
artist, err := controller.GetArtist(app.DB, artistID)
if err != nil {
fmt.Printf("WARN: Failed to fetch artist %s: %s\n", artistID, err)
@ -231,7 +232,8 @@ func serveAddTrack(app *model.AppState, release *model.Release) http.Handler {
func serveNewTrack(app *model.AppState) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
trackID := strings.Split(r.URL.Path, "/")[3]
split := strings.Split(r.URL.Path, "/")
trackID := split[len(split) - 1]
track, err := controller.GetTrack(app.DB, trackID)
if err != nil {
fmt.Printf("WARN: Failed to fetch track %s: %s\n", trackID, err)