Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f53918

Browse files
committed
LoginAndLogout button...
1 parent 1a7f5ae commit 5f53918

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

‎day-15/bs-store/src/components/adminAppbar/AdminAppbar.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ const AdminAppbar = () => {
4848
setAnchorElUser(null);
4949
};
5050

51+
const loginAndLogoutButton = authItems?.isLogin ? (
52+
<Button
53+
key='login'
54+
onClick={() => navigate("/")}
55+
sx={{ my: 2, color: "white", display: "block" }}
56+
>
57+
Logout
58+
</Button>
59+
) : (
60+
<Button
61+
key='login'
62+
onClick={() => navigate("/auth/login")}
63+
sx={{ my: 2, color: "white", display: "block" }}
64+
>
65+
Login
66+
</Button>
67+
);
68+
5169
return (
5270
<AppBar position='static'>
5371
<Container maxWidth='xl'>
@@ -173,15 +191,7 @@ const AdminAppbar = () => {
173191

174192
<ThemeMenu />
175193

176-
<div>
177-
<Button
178-
key='login'
179-
onClick={() => navigate("/auth/login")}
180-
sx={{ my: 2, color: "white", display: "block" }}
181-
>
182-
Login
183-
</Button>
184-
</div>
194+
<div>{loginAndLogoutButton}</div>
185195
</Toolbar>
186196
</Container>
187197
</AppBar>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /