fix: GoalsViewModel use repo.loadDay instead of missing goals()
All checks were successful
Security Checks / dependency-audit (push) Successful in 12s
Security Checks / secret-scanning (push) Successful in 3s
Security Checks / dockerfile-lint (push) Successful in 4s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-03 02:01:30 -05:00
parent c934791a4a
commit 9438421207

View File

@@ -2,7 +2,7 @@ import Foundation
@MainActor @Observable
final class GoalsViewModel {
var goal: DailyGoal = .defaultGoal
var goal: DailyGoal = DailyGoal()
var isLoading = true
var errorMessage: String?
@@ -11,13 +11,11 @@ final class GoalsViewModel {
func load() async {
isLoading = true
errorMessage = nil
do {
goal = try await repo.goals(for: Date().apiDateString, forceRefresh: true)
} catch {
errorMessage = error.localizedDescription
await repo.loadDay(date: Date().apiDateString)
goal = repo.goals
if let err = repo.error {
errorMessage = err
}
isLoading = false
}
}