login method
Logs the user in.
This method will attempt to log the user in with the given username and password.
Implementation
Future<void> login(String username, String password) async {
state = AsyncLoading();
state = await AsyncValue.guard(() async {
var moodleMobileAppToken =
await moodleMobileAppAuthService.requestToken(username, password);
var lbPlannerApiToken =
await lbPlannerApiAuthService.requestToken(username, password);
var tokens = UserToken(
moodleMobileAppToken: moodleMobileAppToken,
lbPlannerApiToken: lbPlannerApiToken);
await localConfigService.saveConfig(tokens);
return tokens;
});
}