mirror of
https://gitlab.com/comunic/comunicconsole
synced 2024-11-27 07:49:22 +00:00
Can sign out
This commit is contained in:
parent
e75993b024
commit
1e6de3454f
@ -89,4 +89,18 @@ export class AccountHelper {
|
|||||||
if (currentAccount == null) throw new Error("Current account is null!");
|
if (currentAccount == null) throw new Error("Current account is null!");
|
||||||
return currentAccount;
|
return currentAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign out current user
|
||||||
|
*/
|
||||||
|
static async signOut() {
|
||||||
|
try {
|
||||||
|
await serverRequest("accounts/sign_out");
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
sessionStorage.removeItem(SESSION_STORAGE_TOKEN);
|
||||||
|
document.location.href = document.location.href + "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,11 @@ function Menu() {
|
|||||||
|
|
||||||
export function MainRoute() {
|
export function MainRoute() {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const signOut = () => {
|
||||||
|
AccountHelper.signOut();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<AppBar
|
<AppBar
|
||||||
@ -130,7 +135,7 @@ export function MainRoute() {
|
|||||||
<small>{AccountHelper.currentAccount.email}</small>
|
<small>{AccountHelper.currentAccount.email}</small>
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<IconButton aria-label="delete">
|
<IconButton aria-label="delete" onClick={signOut}>
|
||||||
<CloseSharpIcon />
|
<CloseSharpIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
Loading…
Reference in New Issue
Block a user