Skip to content

Commit

Permalink
Clear ErrorLabel on login and logout
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Oct 12, 2023
1 parent 1390dbd commit 717b2ef
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions Sample/Auth0MauiApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Auth0.OidcClient;
using Auth0.OidcClient;
using Auth0.OidcClient.MAUI;
using IdentityModel.OidcClient;
using IdentityModel.OidcClient.Browser;

using IdentityModel.OidcClient;
using IdentityModel.OidcClient.Browser;

namespace Auth0MauiApp
{
public partial class MainPage : ContentPage
Expand Down Expand Up @@ -34,18 +34,19 @@ private async void OnLoginClicked(object sender, EventArgs e)

private async void OnLogoutClicked(object sender, EventArgs e)
{
BrowserResultType browserResult = await client.LogoutAsync();

if (browserResult != BrowserResultType.Success)
{
ErrorLabel.Text = browserResult.ToString();
return;
}

BrowserResultType browserResult = await client.LogoutAsync();

if (browserResult != BrowserResultType.Success)
{
ErrorLabel.Text = browserResult.ToString();
return;
}

LogoutBtn.IsVisible = false;
LoginBtn.IsVisible = true;

LoginBtn.IsVisible = true;

HelloLabel.Text = $"Hello, World!";
ErrorLabel.Text = "";
}

private void DisplayResult(LoginResult loginResult)
Expand All @@ -54,13 +55,14 @@ private void DisplayResult(LoginResult loginResult)
{
ErrorLabel.Text = loginResult.Error;
return;
}

}

LogoutBtn.IsVisible = true;
LoginBtn.IsVisible = false;


LoginBtn.IsVisible = false;


HelloLabel.Text = $"Hello, {loginResult.User.Identity.Name}";
ErrorLabel.Text = "";
}
}
}

0 comments on commit 717b2ef

Please sign in to comment.