-
Notifications
You must be signed in to change notification settings - Fork 2
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
} | ||
|
||
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
} | ||
} | ||
}.onReceive(inspection.notice) { self.inspection.visit(self, $0) } // ViewInspector |
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. If nalexn/ViewInspector#231 is ever resolved you'd be able to just wrap the view with the inspector at test-time instead.
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
.