Allow use of useCurrentUser/useCurrentTeam hooks in unauthenticated components
This commit is contained in:
@@ -5,6 +5,7 @@ import styled from "styled-components";
|
||||
import { NavigationNode } from "@shared/types";
|
||||
import Scrollable from "~/components/Scrollable";
|
||||
import SearchPopover from "~/components/SearchPopover";
|
||||
import useCurrentUser from "~/hooks/useCurrentUser";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import history from "~/utils/history";
|
||||
import { homePath, sharedDocumentPath } from "~/utils/routeHelpers";
|
||||
@@ -22,7 +23,8 @@ type Props = {
|
||||
|
||||
function SharedSidebar({ rootNode, shareId }: Props) {
|
||||
const team = useTeamContext();
|
||||
const { ui, documents, auth } = useStores();
|
||||
const user = useCurrentUser({ rejectOnEmpty: false });
|
||||
const { ui, documents } = useStores();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
@@ -33,7 +35,7 @@ function SharedSidebar({ rootNode, shareId }: Props) {
|
||||
image={<TeamLogo model={team} size={32} alt={t("Logo")} />}
|
||||
onClick={() =>
|
||||
history.push(
|
||||
auth.user ? homePath() : sharedDocumentPath(shareId, rootNode.url)
|
||||
user ? homePath() : sharedDocumentPath(shareId, rootNode.url)
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user