From c3bdef480060f67d176e00e7c88314839387ae65 Mon Sep 17 00:00:00 2001 From: m5r Date: Fri, 15 Oct 2021 22:30:57 +0200 Subject: [PATCH] allow logging out from settings --- app/settings/components/divider.tsx | 6 +++-- app/settings/components/settings-layout.tsx | 28 +++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/settings/components/divider.tsx b/app/settings/components/divider.tsx index 8c78520..c87a54c 100644 --- a/app/settings/components/divider.tsx +++ b/app/settings/components/divider.tsx @@ -1,6 +1,8 @@ -export default function Divider() { +import clsx from "clsx"; + +export default function Divider({ className = "" }) { return ( -
+
diff --git a/app/settings/components/settings-layout.tsx b/app/settings/components/settings-layout.tsx index 9c05277..23b81b4 100644 --- a/app/settings/components/settings-layout.tsx +++ b/app/settings/components/settings-layout.tsx @@ -1,9 +1,17 @@ import type { FunctionComponent } from "react"; -import { Link, Routes, useRouter } from "blitz"; +import { Link, Routes, useMutation, useRouter } from "blitz"; import clsx from "clsx"; -import { IoChevronBack, IoNotificationsOutline, IoCardOutline, IoPersonCircleOutline } from "react-icons/io5"; +import { + IoChevronBack, + IoLogOutOutline, + IoNotificationsOutline, + IoCardOutline, + IoPersonCircleOutline, +} from "react-icons/io5"; -import Layout from "../../core/layouts/layout"; +import Layout from "app/core/layouts/layout"; +import logout from "app/auth/mutations/logout"; +import Divider from "./divider"; const subNavigation = [ { name: "Account", href: Routes.Account(), icon: IoPersonCircleOutline }, @@ -13,6 +21,7 @@ const subNavigation = [ const SettingsLayout: FunctionComponent = ({ children }) => { const router = useRouter(); + const [logoutMutation] = useMutation(logout); return ( @@ -27,7 +36,7 @@ const SettingsLayout: FunctionComponent = ({ children }) => {