Skip to content

Commit

Permalink
feat: support logout from settings
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerGirlandCo committed Jun 1, 2023
1 parent 0d98ebf commit b5e92d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/app/interface/settings/client/Logout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Navigate } from "../../../../routing/index";

/**
* redirect to login page after logout
*/
export default function Logout() {
return <Navigate href="/login" />;
}
10 changes: 10 additions & 0 deletions components/app/interface/settings/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import bots from "./Bots";
import experiments from "./Experiments";
import feedback from "./Feedback";
import language from "./Language";
import logout from "./Logout";
import native from "./Native";
import notifications from "./Notifications";
import sessions from "./Sessions";
Expand Down Expand Up @@ -196,6 +197,14 @@ const Config: SettingsConfiguration<{ server: Server }> = {
{
id: "logout",
icon: <BiSolidExit size={20} color={theme!.colours.error} />,
href: "/login",
onClick: () => {
const acli = getController("state");
const cli = getController("client").getCurrentClient();
console.log(cli);
acli.auth.removeSession(cli?.user?.id as string);
window.location.href = "/login";
},
title: (
<ColouredText colour={theme!.colours.error}>
{t("app.settings.pages.logOut")}
Expand Down Expand Up @@ -227,4 +236,5 @@ const ClientSettingsRouting: Record<string, Component> = {
sync,
native,
experiments,
logout,
};

0 comments on commit b5e92d5

Please sign in to comment.