rate limit handling

This commit is contained in:
2026-01-05 20:55:37 -06:00
parent d4e7e4bb65
commit 6302018647
6 changed files with 100 additions and 13 deletions

View File

@@ -51,6 +51,11 @@ class _LoginScreenState extends State<LoginScreen> {
final response = await regularPost(payload, 'login');
if (response.statusCode != 200) {
if (response.statusCode == 400) {throw Exception('Email and Password Necessary');}
else if (response.statusCode == 429) {
final body = json.decode(response.body);
final retryAfter = body['retryAfter'] ?? 'some time';
throw Exception('Too many login attempts. Please try again in $retryAfter minutes.');
}
else if (response.statusCode == 500) {throw Exception('Server Error');}
else {throw Exception('Incorrect email or password');}
}