added guardian letters with chat and multiple answer functionalities
This commit is contained in:
@@ -84,21 +84,9 @@ class GuardianLoginException extends AppException {
|
||||
'Bitte versuche es später erneut.',
|
||||
};
|
||||
|
||||
/// Accepts the documented JSON body (`{"error": …, "attemptsLeft": …}`) as
|
||||
/// well as the plain-text `Fehler: <code>` the server's generic error
|
||||
/// handler produces.
|
||||
static (String?, int?) _parseBody(Object? data) {
|
||||
if (data is Map) {
|
||||
final attempts = data['attemptsLeft'];
|
||||
return (data['error'] as String?, attempts is int ? attempts : null);
|
||||
}
|
||||
if (data is String) {
|
||||
final code = data.startsWith('Fehler: ')
|
||||
? data.substring('Fehler: '.length)
|
||||
: data;
|
||||
return (code.trim(), null);
|
||||
}
|
||||
return (null, null);
|
||||
final attempts = data is Map ? data['attemptsLeft'] : null;
|
||||
return (marianumConnectErrorCode(data), attempts is int ? attempts : null);
|
||||
}
|
||||
|
||||
static GuardianLoginError? _errorFor(String? code, int status) =>
|
||||
|
||||
Reference in New Issue
Block a user