- java.lang.Object
-
- stores.AuthStore
-
public class AuthStore extends java.lang.Object
TheAuthStore
class provides utility methods for managing the current authenticated user within the application. It offers methods to get and set the current authenticated user, as well as check if the user is logged in.
-
-
Field Summary
Fields Modifier and Type Field Description private static User
currentUser
The currently authenticated user.
-
Constructor Summary
Constructors Modifier Constructor Description private
AuthStore()
Private constructor to prevent instantiation of the class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static User
getCurrentUser()
Gets the current user from the AuthStorestatic boolean
isLoggedIn()
Checks if the user is logged in.static void
setCurrentUser(User currentUser)
Set the current user in the AuthStore
-
-
-
Field Detail
-
currentUser
private static User currentUser
The currently authenticated user.
-
-
Method Detail
-
getCurrentUser
public static User getCurrentUser()
Gets the current user from the AuthStore- Returns:
- current
User
instance currentUser, ornull
if the user is not logged in
-
setCurrentUser
public static void setCurrentUser(User currentUser)
Set the current user in the AuthStore- Parameters:
currentUser
- the currentUser to set as the current user withUser
instance
-
isLoggedIn
public static boolean isLoggedIn()
Checks if the user is logged in.- Returns:
true
if the user is logged in, otherwisefalse
-
-