You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Seekers/Helpers/AuthHelper.cs

27 lines
707 B

using Microsoft.Maui.Storage;
namespace Justice.Helpers
{
public static class AuthHelper
{
private const string IsLoggedInKey = "IsLoggedIn";
private const string UserRoleKey = "UserRole";
public static bool IsLoggedIn => Preferences.Get(IsLoggedInKey, false);
public static string UserRole => Preferences.Get(UserRoleKey, string.Empty);
public static void Login(string role)
{
Preferences.Set(IsLoggedInKey, true);
Preferences.Set(UserRoleKey, role);
}
public static void Logout()
{
Preferences.Remove(IsLoggedInKey);
Preferences.Remove(UserRoleKey);
}
}
}