fix: going to accounts page when logged out causes crash

This commit is contained in:
thecodrr
2020-05-04 12:14:07 +05:00
parent 3978d16715
commit 7e1ffb6020

View File

@@ -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();
}
}}
>
<Flex
variant="columnCenter"