48 lines
984 B
Swift
48 lines
984 B
Swift
//
|
|
// ItemPersonDetailView.swift
|
|
// Jel
|
|
//
|
|
// Created by zerocool on 1/13/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
import JellyfinKit
|
|
|
|
struct ItemPersonDetailView: View {
|
|
@ObservedObject var authState: AuthStateController = AuthStateController.shared
|
|
@EnvironmentObject var jellyfinClient: JellyfinClientController
|
|
|
|
var person: BaseItemPerson
|
|
|
|
@State var personItem: BaseItemDto?
|
|
@State var loading: Bool = true
|
|
|
|
var body: some View {
|
|
VStack {
|
|
if loading {
|
|
ProgressView()
|
|
.progressViewStyle(.circular)
|
|
}
|
|
|
|
if let personItem = personItem {
|
|
ItemView(item: personItem)
|
|
}
|
|
}
|
|
.onAppear {
|
|
Task {
|
|
let request = Paths.getItem(userID: authState.userId ?? "", itemID: person.id ?? "")
|
|
|
|
do {
|
|
let res = try await jellyfinClient.send(request)
|
|
personItem = res.value
|
|
loading = false
|
|
} catch {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// ItemPersonDetailView()
|
|
//}
|