userSettingUpdate method

Future<Response> userSettingUpdate({
  1. required int userId,
  2. required bool orderUpdateNotification,
  3. required bool promotionNotification,
})

To update user settings in whitelabel app user needs to use below API

Implementation

Future<http.Response> userSettingUpdate({
  required int userId,
  required bool orderUpdateNotification,
  required bool promotionNotification,
}) async {
  Uri url = Uri.parse("$_baseUrl/user/setting/update/$userId");

  final body = jsonEncode({
    "order_update_notification": orderUpdateNotification,
    "promotion_notification": promotionNotification,
  });

  http.Response response = await http.Client()
      .put(url, body: body, headers: kAuthenticatedPostRequestHeader);

  if (response.statusCode == 200) {
    printMessage("UPDATE USER SETTING RESPONSE = ${response.body}");
    return response;
  } else {
    printMessage("UPDATE USER SETTING RESPONSE = ${response.statusCode}");
    printMessage("UPDATE USER SETTING RESPONSE = ${response.body}");
    return response;
  }
}