fix: health API uses JWT auth, Finance tab replaced with Health

This commit is contained in:
Cosmo
2026-03-25 17:47:33 +00:00
parent 7748392c31
commit 0d5eef1b87
3 changed files with 62 additions and 43 deletions

View File

@@ -177,11 +177,9 @@ struct HealthView: View {
func loadData(refresh: Bool = false) async {
if !refresh { isLoading = true }
let apiKey = authManager.healthApiKey
async let r = HealthAPIService.shared.getReadiness(apiKey: apiKey)
async let l = HealthAPIService.shared.getLatest(apiKey: apiKey)
async let h = HealthAPIService.shared.getHeatmap(apiKey: apiKey, days: 7)
async let r = HealthAPIService.shared.getReadiness()
async let l = HealthAPIService.shared.getLatest()
async let h = HealthAPIService.shared.getHeatmap(days: 7)
readiness = try? await r
latest = try? await l
@@ -198,11 +196,6 @@ struct HealthView: View {
return
}
guard !authManager.healthApiKey.isEmpty else {
showToastMessage("Health API ключ не найден", success: false)
return
}
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
do {

View File

@@ -16,10 +16,8 @@ struct MainTabView: View {
TrackerView()
.tabItem { Label("Трекер", systemImage: "chart.bar.fill") }
if authManager.userId == 1 {
FinanceView()
.tabItem { Label("Финансы", systemImage: "creditcard.fill") }
}
HealthView()
.tabItem { Label("Здоровье", systemImage: "heart.fill") }
SavingsView()
.tabItem { Label("Накопления", systemImage: "building.columns.fill") }