async void Create(object obj) { try { await _api.Post("/users/create", _currentUser); _eventAggregator.PublishNavigation("userCreatedNav", null); } catch (HttpRequestException) { _eventAggregator.PublishMessage("userCreatedError", "Ingen forbindelse til API"); } catch (Exception e) { _eventAggregator.PublishMessage("userCreatedError", e.Message); } }
async void Login(object obj) { try { await _api.Post("login", new User { Username = _username, Password = _password }); //TODO fiks navigation _eventAggregator.PublishNavigation("Dashboard", new User()); } catch (HttpRequestException) { _eventAggregator.PublishMessage("LoginViewError", "Ingen forbindelse til API"); } catch (Exception e) { _eventAggregator.PublishMessage("LoginViewError", e.Message); } }