Skip to content

Commit 3311dae

Browse files
Vamshi-MicrosoftCopilot
andcommitted
Rename logout to signOut in UserProfile and useAuth for consistency; update related comments and method calls.
Co-authored-by: Copilot <copilot@github.com>
1 parent 4e83a97 commit 3311dae

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/frontend/src/components/Header/UserProfile.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import useAuth from "../../msal-auth/useAuth";
1919
/**
2020
* @component UserProfile
2121
* @description Renders an avatar in the header. Clicking opens a menu showing
22-
* the signed-in user's name and email along with a Logout option.
22+
* the signed-in user's name and email along with a Sign out option.
2323
* Designed to be rendered only when MSAL authentication is enabled.
2424
*/
2525
const getInitials = (name?: string, username?: string): string => {
@@ -45,7 +45,7 @@ const getInitials = (name?: string, username?: string): string => {
4545
};
4646

4747
const UserProfile: React.FC = () => {
48-
const { isAuthenticated, accounts, logout } = useAuth();
48+
const { isAuthenticated, accounts, signOut } = useAuth();
4949

5050
if (!isAuthenticated || !accounts || accounts.length === 0) {
5151
return null;
@@ -56,9 +56,9 @@ const UserProfile: React.FC = () => {
5656
const email = account?.username || "";
5757
const initials = getInitials(account?.name, account?.username);
5858

59-
const handleLogout = (e: React.MouseEvent) => {
59+
const handleSignOut = (e: React.MouseEvent) => {
6060
e.stopPropagation();
61-
logout();
61+
signOut();
6262
};
6363

6464
return (
@@ -124,8 +124,8 @@ const UserProfile: React.FC = () => {
124124
</div>
125125
</MenuItem>
126126
<MenuDivider />
127-
<MenuItem icon={<SignOut20Regular />} onClick={handleLogout}>
128-
Logout
127+
<MenuItem icon={<SignOut20Regular />} onClick={handleSignOut}>
128+
Sign out
129129
</MenuItem>
130130
</MenuList>
131131
</MenuPopover>

src/frontend/src/msal-auth/useAuth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ const useAuth = () => {
7676
}
7777
};
7878

79-
const logout = async () => {
79+
const signOut = async () => {
8080
if (!msalInstance) {
81-
console.error("MSAL Instance is not available for logout.");
81+
console.error("MSAL Instance is not available for sign out.");
8282
return;
8383
}
8484

@@ -89,10 +89,10 @@ const useAuth = () => {
8989
});
9090
localStorage.removeItem('token');
9191
} else {
92-
console.warn("No active account found for logout.");
92+
console.warn("No active account found for sign out.");
9393
}
9494
} catch (error) {
95-
console.error("Logout failed:", error);
95+
console.error("Sign out failed:", error);
9696
}
9797
};
9898

@@ -130,7 +130,7 @@ const useAuth = () => {
130130
return {
131131
isAuthenticated,
132132
login,
133-
logout,
133+
signOut,
134134
user,
135135
accounts,
136136
inProgress,

0 commit comments

Comments
 (0)