fixd larg lines in HomePage , add cookies rather than localStorage,make canvas background Login page
This commit is contained in:
18
app/hooks/useAuth.js
Normal file
18
app/hooks/useAuth.js
Normal file
@ -0,0 +1,18 @@
|
||||
// app/hooks/useAuth.js
|
||||
import AuthService from "../services/AuthService";
|
||||
|
||||
export default function useAuth() {
|
||||
const authUser = AuthService.getUser();
|
||||
const role = authUser?.roles;
|
||||
return {
|
||||
user: authUser,
|
||||
name: authUser?.name ?? "Not found",
|
||||
email: authUser?.email ?? "Not found",
|
||||
isOwner: role?.includes("Owner"),
|
||||
isAgent: role?.includes("RealEstateAgent",""),
|
||||
isCustomer: role?.includes("Customer"),
|
||||
role: role,
|
||||
isGuest: !authUser,
|
||||
isAuthenticated: !!authUser,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user