2020-08-12 14:36:49 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct MacAccountView: View {
|
2020-08-18 21:20:16 +00:00
|
|
|
@EnvironmentObject var model: WriteFreelyModel
|
2022-07-28 11:38:19 +00:00
|
|
|
@EnvironmentObject var errorHandling: ErrorHandling
|
2020-08-12 14:36:49 +00:00
|
|
|
|
|
|
|
var body: some View {
|
2022-07-28 11:38:19 +00:00
|
|
|
Form {
|
|
|
|
AccountView()
|
|
|
|
}
|
|
|
|
.onChange(of: model.hasError) { value in
|
|
|
|
if value {
|
|
|
|
if let error = model.currentError {
|
|
|
|
self.errorHandling.handle(error: error)
|
|
|
|
} else {
|
|
|
|
self.errorHandling.handle(error: AppError.genericError())
|
|
|
|
}
|
|
|
|
model.hasError = false
|
2020-08-12 14:36:49 +00:00
|
|
|
}
|
2022-07-28 11:38:19 +00:00
|
|
|
}
|
2020-08-12 14:36:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct MacAccountView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2020-08-18 21:20:16 +00:00
|
|
|
MacAccountView()
|
|
|
|
.environmentObject(WriteFreelyModel())
|
2020-08-12 14:36:49 +00:00
|
|
|
}
|
|
|
|
}
|