2021-06-28 16:13:07 +05:30
|
|
|
import Siesta
|
2021-06-12 02:41:59 +05:30
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ChannelView: View {
|
2021-06-28 16:13:07 +05:30
|
|
|
@ObservedObject private var store = Store<[Video]>()
|
2021-06-12 02:41:59 +05:30
|
|
|
|
2021-06-28 16:13:07 +05:30
|
|
|
var id: String
|
2021-06-12 02:41:59 +05:30
|
|
|
|
2021-06-28 16:13:07 +05:30
|
|
|
var resource: Resource {
|
|
|
|
InvidiousAPI.shared.channelVideos(id)
|
2021-06-12 02:41:59 +05:30
|
|
|
}
|
|
|
|
|
2021-06-28 16:13:07 +05:30
|
|
|
init(id: String) {
|
|
|
|
self.id = id
|
|
|
|
resource.addObserver(store)
|
|
|
|
}
|
2021-06-12 02:41:59 +05:30
|
|
|
|
2021-06-28 16:13:07 +05:30
|
|
|
var body: some View {
|
|
|
|
VideosListView(videos: store.collection)
|
|
|
|
.onAppear {
|
|
|
|
resource.loadIfNeeded()
|
|
|
|
}
|
2021-06-12 02:41:59 +05:30
|
|
|
}
|
|
|
|
}
|