Verified Commit 008ec351 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add page for all songs

parent fda41d1b
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
import Base from "./Base.js"
import SongList from "../pieces/SongList.js"
import Song from "../../model/Song.js"
import search from "../../model/search.js"

export default {
    oncreate() {
        document.title = "Alle Songs · Karaokatalog"
    },
    oninit() {
        Song.load()
    },
    view() {
        const songs = search.apply(Song.all)
        const message = !songs ? "Lade Songs..." : songs.length === 0 ? "Keine Songs gefunden." : null

        return m(
            Base,
            message && m("p", message),
            songs && m(SongList, { songs })
        )
    },
}