apiPosAuth method

Future apiPosAuth({
  1. required String endpoint,
  2. required Map<String, dynamic> body,
  3. required BuildContext context,
})

Implementation

Future<dynamic> apiPosAuth({
  required String endpoint,
  required Map<String, dynamic> body,
  required BuildContext context,
}) async {
  try {
    log("API POST CALL : ${apiBaseUrl + endpoint}");
    dio.Response rawResponse = await _dio.post(apiBaseUrl + endpoint,
        data: body,
        options: dio.Options(
          followRedirects: false,
          validateStatus: (status) {
            return status! < 300;
          },
        ));

    return rawResponse.data;
  } on dio.DioException catch (_) {
    rethrow;

    // log(e.error.toString());
    // log(e.response.toString());
  }
}