sendOtp method

  1. @override
Future<AuthResult<void>> sendOtp(
  1. String contact,
  2. AuthMethod method
)
override

Implementation

@override
Future<AuthResult<void>> sendOtp(String contact, AuthMethod method) async {
  try {
    final response = await _client.post(
      Uri.parse('$baseUrl/auth/send-otp'),
      headers: _headers,
      body: jsonEncode({'contact': contact, 'method': method.name}),
    );
    return _handleResponse(response);
  } catch (e) {
    return AuthResult.failure(AuthException(e.toString(), code: 'network-error'));
  }
}