yattee/Shared/Watch Now/WatchNowSection.swift
2021-09-25 11:34:46 +02:00

29 lines
657 B
Swift

import Defaults
import Siesta
import SwiftUI
struct WatchNowSection: View {
let resource: Resource
let label: String
@StateObject private var store = Store<[Video]>()
@EnvironmentObject<InvidiousAPI> private var api
init(resource: Resource, label: String) {
self.resource = resource
self.label = label
}
var body: some View {
WatchNowSectionBody(label: label, videos: store.collection)
.onAppear {
resource.addObserver(store)
resource.load()
}
.onChange(of: api.account) { _ in
resource.load()
}
}
}