Skip to content

Commit 277e6f2

Browse files
committed
Fix signing out not working, add cancel sign in button
1 parent ae02726 commit 277e6f2

File tree

1 file changed

+31
-15
lines changed

1 file changed

+31
-15
lines changed

Core/Sources/HostApp/AccountSettings/CodeiumView.swift

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ struct CodeiumView: View {
154154
Text("Status: Signed In")
155155

156156
Button(action: {
157-
viewModel.isSignedIn = false
157+
Task {
158+
do {
159+
try await viewModel.signOut()
160+
} catch {
161+
toast(Text(error.localizedDescription), .error)
162+
}
163+
}
158164
}) {
159165
Text("Sign Out")
160166
}
@@ -232,21 +238,31 @@ struct CodeiumSignInView: View {
232238
.stroke(Color(nsColor: .separatorColor), lineWidth: 1)
233239
)
234240

235-
Button(action: {
236-
isGeneratingKey = true
237-
Task {
238-
do {
239-
try await viewModel.signIn(token: token)
240-
isGeneratingKey = false
241-
isPresented = false
242-
} catch {
243-
isGeneratingKey = false
244-
toast(Text(error.localizedDescription), .error)
245-
}
241+
HStack {
242+
Spacer()
243+
244+
Button(action: {
245+
isPresented = false
246+
}) {
247+
Text("Cancel")
246248
}
247-
}) {
248-
Text(isGeneratingKey ? "Signing In.." : "Sign In")
249-
}.disabled(isGeneratingKey)
249+
250+
Button(action: {
251+
isGeneratingKey = true
252+
Task {
253+
do {
254+
try await viewModel.signIn(token: token)
255+
isGeneratingKey = false
256+
isPresented = false
257+
} catch {
258+
isGeneratingKey = false
259+
toast(Text(error.localizedDescription), .error)
260+
}
261+
}
262+
}) {
263+
Text(isGeneratingKey ? "Signing In.." : "Sign In")
264+
}.disabled(isGeneratingKey)
265+
}
250266
}
251267
.padding()
252268
.onAppear {

0 commit comments

Comments
 (0)