WIP
This commit is contained in:
@@ -12,6 +12,7 @@ struct LoginView: View {
|
|||||||
@State var password: String = ""
|
@State var password: String = ""
|
||||||
@Environment(\.dismiss) var dismiss
|
@Environment(\.dismiss) var dismiss
|
||||||
let completion: (() -> Void)
|
let completion: (() -> Void)
|
||||||
|
@State var doingNetworkShit: Bool = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -35,19 +36,27 @@ struct LoginView: View {
|
|||||||
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)))
|
.overlay(RoundedRectangle(cornerRadius: 16).stroke(Color(uiColor: .clear))).background(Color(uiColor: .init(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)))
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
|
|
||||||
Button("Login", action: {
|
if doingNetworkShit {
|
||||||
login()
|
ProgressView("Logging In")
|
||||||
})
|
.padding()
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.foregroundColor(.white)
|
||||||
.frame(height: 44)
|
.progressViewStyle(CircularProgressViewStyle(tint: .white))
|
||||||
.foregroundColor(.blue)
|
.scaleEffect(1.5, anchor: .center)
|
||||||
.background(.yellow)
|
} else {
|
||||||
.cornerRadius(8)
|
Button("Login", action: {
|
||||||
.padding()
|
login()
|
||||||
.frame(maxWidth: .infinity)
|
})
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
.frame(height: 44)
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
.background(.yellow)
|
||||||
|
.cornerRadius(8)
|
||||||
|
.padding()
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.disabled(password.isEmpty || email.isEmpty)
|
||||||
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
.background(
|
.background(
|
||||||
@@ -63,7 +72,9 @@ struct LoginView: View {
|
|||||||
"email": email,
|
"email": email,
|
||||||
"password": password
|
"password": password
|
||||||
]
|
]
|
||||||
|
doingNetworkShit = true
|
||||||
UserStore.shared.login(postData: postData, completion: { success in
|
UserStore.shared.login(postData: postData, completion: { success in
|
||||||
|
doingNetworkShit = false
|
||||||
if success {
|
if success {
|
||||||
completion()
|
completion()
|
||||||
dismiss()
|
dismiss()
|
||||||
|
|||||||
Reference in New Issue
Block a user