sendResetPasswordOtp static method

Future sendResetPasswordOtp(
  1. dynamic body
)

Implementation

static Future sendResetPasswordOtp(body) async {
  try {

    final SharedPreferences prefs = await SharedPreferences.getInstance();
    var storeId = await StoreBountyInit.getStoreId();
    final jsonData = await StoreBountyInit.readJsonFromRoot();

    var data = {
      "app_id": "storebounty",
      "business_id": storeId,
      "email": prefs.getString("authEmail")
    };

    print(data);

    final response = await HttpClientClass.postRequestAuth("${jsonData['BASE_URL']}/accounts/api/v1/auth/customers/otp/send", data);

    print(response.body);

    if (response.statusCode == 200) {
      return response;
    } else if (response.statusCode == 412) {
      var error = jsonDecode(response.body);
      throw (error['message']);
    } else {
      throw ("Unknown error");
    }

  } catch (e) {
    rethrow;
  }
}