Created
October 24, 2021 10:21
-
-
Save vaygeth89/f001dbd6523c8ad6f2d0b6b0f91a132b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Future<AuthenticationData> signIn({ | |
required SignIn signIn, | |
String routePath = "sign-in", | |
}) async { | |
try { | |
var result = await super | |
._dio | |
.post(routePath, data: signIn.toJson()) | |
.timeout(super.timeout); | |
if (result.statusCode == 200) { | |
return AuthenticationData.fromJson(result.data); | |
} | |
throw DioError(requestOptions: result.requestOptions); | |
} on DioError catch (error) { | |
var businessError = BusinessError.fromJson(error.response?.data); | |
throw BusinessException(businessError, | |
statusCode: error.response?.statusCode); | |
} catch (error) { | |
throw Error(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment