mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Add account button with log out
Add a button on the right of the top nav bar to access account related functions and add a log out button there. To make it fit on the navbar the text and version is hidden on narrow layouts.
This commit is contained in:
1 parent
9542246414
commit
e1549c1b0c
5 files changed
+106
-6
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { useContext } from "react";
|
||||
|
||||
import { notifyErrorHandler } from "../util/notify";
|
||||
import ControlContext from "../components/ControlContext";
|
||||
|
||||
/**
|
||||
* @typedef {Object} Account
|
||||
* @property {function()} logout - Logs out of the web interface.
|
||||
*/
|
||||
|
||||
export function useAccount() {
|
||||
let control = useContext(ControlContext);
|
||||
|
||||
return {
|
||||
logOut() {
|
||||
control.loggingOut = true;
|
||||
control.shutdown(notifyErrorHandler("Error logging out"));
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user