From 7e1ffb60200d9b52947a1e93375d6df85ea92cf1 Mon Sep 17 00:00:00 2001 From: thecodrr Date: Mon, 4 May 2020 12:14:07 +0500 Subject: [PATCH] fix: going to accounts page when logged out causes crash --- apps/web/src/views/Settings.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/src/views/Settings.js b/apps/web/src/views/Settings.js index ab9b08b23..89e541685 100644 --- a/apps/web/src/views/Settings.js +++ b/apps/web/src/views/Settings.js @@ -5,6 +5,7 @@ import { useStore as useUserStore } from "../stores/user-store"; import { useStore as useThemeStore } from "../stores/theme-store"; import AccentItem from "../components/accent-item"; import accents from "../theme/accents"; +import { showLogInDialog } from "../components/dialogs/logindialog"; function Settings(props) { const theme = useThemeStore((store) => store.theme); @@ -18,7 +19,13 @@ function Settings(props) { bg="shade" p={2} sx={{ borderRadius: "default", cursor: "pointer" }} - onClick={() => props.navigator.navigate("account")} + onClick={async () => { + if (isLoggedIn) { + props.navigator.navigate("account"); + } else { + await showLogInDialog(); + } + }} >