getAuthToken method

Future<void> getAuthToken()

Implementation

Future<void> getAuthToken() async {
  _setLoadingState(isAuthLoading: true);
  try {
    final response = await DioHelper.postData(
      url: '/auth/tokens',
      data: {
        "api_key": paymentData.apiKey,
      },
    );
    paymentFirstToken = response.data['token'];
    _setSuccessState(isAuthSuccess: true);
  } catch (error) {
    _setFailureState(isAuthFailure: true);
  } finally {
    _setLoadingState(isAuthLoading: false);
  }
}