Skip to content

Commit

Permalink
Revert "avoiding two force unwraps by using a goal's owner's username"
Browse files Browse the repository at this point in the history
This reverts commit 1f3af669fdc5296092b8df4eba0d3d7f855ee226.

removing a commit that did not directly contribute to the solution
  • Loading branch information
krugerk committed Dec 29, 2024
1 parent 45899c6 commit b3d893c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BeeKit/Managers/GoalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public actor GoalManager {
public func refreshGoal(_ goalID: NSManagedObjectID) async throws {
let goal = try modelContext.existingObject(with: goalID) as! Goal

let responseObject = try await requestManager.get(url: "/api/v1/users/\(goal.owner.username)/goals/\(goal.slug)?datapoints_count=5", parameters: nil)
let responseObject = try await requestManager.get(url: "/api/v1/users/\(currentUserManager.username!)/goals/\(goal.slug)?datapoints_count=5", parameters: nil)
let goalJSON = JSON(responseObject!)

// The goal may have changed during the network operation, reload latest version
Expand All @@ -85,7 +85,7 @@ public actor GoalManager {
}

public func forceAutodataRefresh(_ goal: Goal) async throws {
let _ = try await requestManager.get(url: "/api/v1/users/\(goal.owner.username)/goals/\(goal.slug)/refresh_graph.json", parameters: nil)
let _ = try await requestManager.get(url: "/api/v1/users/\(currentUserManager.username!)/goals/\(goal.slug)/refresh_graph.json", parameters: nil)
}

private func updateGoalsFromJson(_ responseJSON: JSON) {
Expand Down

0 comments on commit b3d893c

Please sign in to comment.