register static method

Future register(
  1. dynamic body
)

Implementation

static Future register(body) async {
  try {

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

    var data = {
      "app_id": "storebounty",
      "business_id": storeId,
      "email": body['email'],
      "first_name": body['first_name'],
      "last_name": body['last_name'],
      "phone": body['phone'],
      "password": body['password'],
      // "platform": "mobile",
      // "firebase_device_id": "HGHFTYUYJLKJ778GHJG6456VHJ",
      "fingerprint": {
        // "id": "123",
        // "model": "SM-G970U1",
        // "os_version": 11,
        // "screen_width": 360,
        // "screen_height": 760,
        // "manufacturer": "samsung",
        // "is_physical_device": true,
        // "screen_resolution": "1080x2280",
        // "firebase_device_token": "HGHFTYUYJLKJ778GHJG6456VHJ",
        // "ip": "107.181.180.171"
      }
    };

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

    print(response.body);

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

  } catch (e) {
    rethrow;
  }
}