Skip to content

Commit

Permalink
Merge pull request #955 from syucream/feature/login-name
Browse files Browse the repository at this point in the history
Show login user name on the header
  • Loading branch information
hinashi authored Sep 19, 2023
2 parents 4e96c9c + cfa9443 commit 89c8d37
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ export const Header: FC = () => {
keepMounted
disableScrollLock
>
<MenuItem>
{djangoContext?.user?.username ?? "不明なユーザ"}{" "}
としてログイン中
</MenuItem>
<Divider light />
<MenuItem
component={Link}
to={userPath(djangoContext?.user?.id ?? 0)}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/services/DjangoContext.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class User {
id: number;
username: string;
isSuperuser: boolean;

constructor(user: any) {
this.id = user.id;
this.username = user.username;
this.isSuperuser = user.isSuperuser;
}
}
Expand Down
1 change: 1 addition & 0 deletions templates/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
version: "{{version}}",
user: {
id: {{user.id}},
username: "{{user.username}}",
isSuperuser: {{user.is_superuser|yesno:"true,false"}},
},
};
Expand Down

0 comments on commit 89c8d37

Please sign in to comment.