loginCustomer method
Authenticates the user via JWT and returns a WooCommerce customer object of the current logged in customer.
Implementation
loginCustomer({
required String username,
required String password,
}) async {
WooCustomer? customer;
try {
var response =
await authenticateViaJWT(username: username, password: password);
_printToLog('attempted token : ' + response.toString());
if (response is String) {
int? id = await fetchLoggedInUserId();
customer = await getCustomerById(id: id);
}
return customer;
} catch (e) {
return e.toString();
}
}