complete mzansi personal and business profile get & store data offline mode
This commit is contained in:
parent
d42337fc6c
commit
8d78fb6357
13 changed files with 240 additions and 61 deletions
|
|
@ -25,6 +25,19 @@ class MihBusinessEmployeeServices {
|
|||
return response.statusCode;
|
||||
}
|
||||
|
||||
Future<List<BusinessEmployee>> fetchEmployeesV2(String business_id) async {
|
||||
final response = await http.get(Uri.parse(
|
||||
"${AppEnviroment.baseApiUrl}/business-user/employees/${business_id}"));
|
||||
if (response.statusCode == 200) {
|
||||
Iterable l = jsonDecode(response.body);
|
||||
List<BusinessEmployee> employeeList = List<BusinessEmployee>.from(
|
||||
l.map((model) => BusinessEmployee.fromJson(model)));
|
||||
return employeeList;
|
||||
} else {
|
||||
throw Exception('failed to load employees');
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> addEmployee(
|
||||
MzansiProfileProvider provider,
|
||||
AppUser newEmployee,
|
||||
|
|
|
|||
|
|
@ -89,6 +89,21 @@ class MihProfileLinksServices {
|
|||
}
|
||||
}
|
||||
|
||||
static Future<List<ProfileLink>> getBusinessProfileLinksV2(
|
||||
String business_id,
|
||||
) async {
|
||||
final response = await http.get(Uri.parse(
|
||||
"${AppEnviroment.baseApiUrl}/profile-links/business/$business_id"));
|
||||
if (response.statusCode == 200) {
|
||||
Iterable l = jsonDecode(response.body);
|
||||
List<ProfileLink> myLinks =
|
||||
List<ProfileLink>.from(l.map((model) => ProfileLink.fromJson(model)));
|
||||
return myLinks;
|
||||
} else {
|
||||
throw Exception('failed to fecth user profile links');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<int> deleteProfileLink(
|
||||
MzansiProfileProvider profileProvider,
|
||||
int idprofile_links,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue