SignUpStatus constructor
SignUpStatus(
- Status status
Implementation
factory SignUpStatus(Status status) {
if (status.body == null) {
return SignUpStatus._(
status: 500,
statusErrors: {SignUpStatusError.UNKNOWN},
error:
'No response, open an issue here: https://github.com/openfoodfacts/openfoodfacts-dart/issues/new',
);
} else if (status.body!.contains('loggedin')) {
return SignUpStatus._(
status: 201,
);
} else {
return SignUpStatus._(
status: 400,
statusErrors:
_findErrorsInMap(status.body) ?? {SignUpStatusError.UNKNOWN},
error: _extractErrorFromHTMLBody(status.body),
);
}
}