/// <summary> /// Method fired on button login click /// </summary> /// <returns>Task</returns> private async Task PostLoginForm() { try { UnloggedLayout.ShowLoader(); await AuthRepository.Login(Username, Password); SessionStorage.SetItem("Token", Client.Token); SessionStorage.SetItem("User", Client.CurrentUser); NavigationManager.NavigateTo(""); } catch (Exception e) { LoginError = e.Message; } finally { UnloggedLayout.HideLoader(); } }
/// <summary> /// Method fired on button register click /// </summary> /// <returns>Task</returns> private async Task PostRegisterForm() { try { UnloggedLayout.ShowLoader(); await AuthRepository.Register(Username, Firstname, Lastname, Email, Password); NavigationManager.NavigateTo($""); } catch (RegisterZestException e) { RegisterError = e.Message; EmailError = e.EmailError; UsernameError = e.UsernameError; } finally { UnloggedLayout.HideLoader(); } }