1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Shared/Watch Now/WatchNowSection.swift

29 lines
657 B
Swift
Raw Normal View History

2021-09-25 13:48:22 +05:30
import Defaults
2021-09-19 02:06:42 +05:30
import Siesta
import SwiftUI
struct WatchNowSection: View {
let resource: Resource
let label: String
2021-09-25 13:48:22 +05:30
@StateObject private var store = Store<[Video]>()
@EnvironmentObject<InvidiousAPI> private var api
2021-09-19 02:06:42 +05:30
init(resource: Resource, label: String) {
self.resource = resource
self.label = label
}
var body: some View {
WatchNowSectionBody(label: label, videos: store.collection)
.onAppear {
2021-09-25 13:48:22 +05:30
resource.addObserver(store)
resource.load()
}
.onChange(of: api.account) { _ in
resource.load()
2021-09-19 02:06:42 +05:30
}
}
}