- Notifications
You must be signed in to change notification settings - Fork3
feat: add login flow & session management#10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ethanndickson commentedDec 11, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, I like the tests
ethanndickson commentedDec 11, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
} | ||
enum ClientError: Error { | ||
case unexpectedStatusCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
case unexpectedStatusCode | |
case unexpectedStatusCode(Int) |
This lets you store the status code
func user(_ ident: String) async throws -> User { | ||
let resp = await request("/api/v2/users/\(ident)", method: .get) | ||
guard let response = resp.response, response.statusCode == 200 else { | ||
throw ClientError.unexpectedStatusCode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
fine for now, but we should be parsing the generic error responses for debugging/troubleshooting
e.g.https://github.com/coder/coder/blob/b39becba66f1c6ad9c8d73694b0d8779cf7467a2/codersdk/client.go#L495
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
} | ||
} | ||
}.onReceive(inspection.notice) { self.inspection.visit(self, $0) } // ViewInspector |
ethanndicksonDec 12, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I absolutely hate that you need to modify your UI code to get the tests to work, but you do. Ifnalexn/ViewInspector#231 is ever resolved you'd be able to just wrap the view with the inspector at test-time instead.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c070ac7
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Closes#3.
Relates to#4.
About
popup.SecureSession
that writes the session token to the keychain, and the server URL toUserDefaults
.Client
for the Swiftcoderd
SDK. Currently only supports theusers
endpoint for validating a session token.Screen.Recording.2024-12-11.at.5.40.42.pm.mov
The 'generate a token' hyperlink takes the user to
/cli-auth
.