mobileLogin method

  1. @override
Future<Either<Failure, Success>> mobileLogin(
  1. String clientId,
  2. String secretKey,
  3. String field,
  4. String uuid,
)
override

Implementation

@override
Future<Either<Failure, Success>> mobileLogin(
    String clientId, String secretKey, String field, String uuid) async {
  try {
    final response = await dio.post('$baseUrl/v3/auth/login',
        options: Options(
          contentType: "application/json",
        ),
        data: {
          "clientId": clientId,
          "secret": secretKey,
          "field": field,
          "uuid": uuid,
        });
    if (response.statusCode == 200) {
      return Right(AuthSuccessToken(response.data["access_token"]));
    } else {
      return Left(GetItemByIDRemoteFailure());
    }
  } catch (e) {
    return Left(GetItemByIDRemoteFailure());
  }
}