login method
Implementation
Future<void> login(String username, String password, Function? onSuccess, Function? onError) async {
await post(
body: {
'username': username,
'password': password,
},
onSuccess: (response) {
if (response.statusCode >= 200 && response.statusCode < 300) {
onSuccess?.call(response);
} else {
onError?.call(response);
}
},
onError: (response) {
onError?.call(response);
}
);
}