mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-09 08:49:36 +00:00
4189a59cf6
* Initial iOS 17 + Observable migration * More Observation * More observation * Checkpoint * Checkpoint * Bump version to 1.8.0 * SwiftFormat * Fix home timeline switch on login * Fix sidebar routerPath * Fixes on detail view * Remove print changes * Simply detail view * More opt * Migrate DisplaySettingsLocalValues * Better post detail transition * Status detail animation finally right * Cleanup
30 lines
619 B
Swift
30 lines
619 B
Swift
import Network
|
|
import Observation
|
|
import SwiftUI
|
|
|
|
@MainActor
|
|
@Observable class EditRelationshipNoteViewModel {
|
|
public var note: String = ""
|
|
public var relatedAccountId: String?
|
|
public var client: Client?
|
|
|
|
var isSaving: Bool = false
|
|
var saveError: Bool = false
|
|
|
|
init() {}
|
|
|
|
func save() async {
|
|
if relatedAccountId != nil,
|
|
client != nil
|
|
{
|
|
isSaving = true
|
|
do {
|
|
_ = try await client!.post(endpoint: Accounts.relationshipNote(id: relatedAccountId!, json: RelationshipNoteData(note: note)))
|
|
} catch {
|
|
isSaving = false
|
|
saveError = true
|
|
}
|
|
}
|
|
}
|
|
}
|