Skip to content

Commit

Permalink
get team from store, not route data
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Nov 28, 2023
1 parent 1f115b5 commit 2ff3541
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const Breadcrumbs: React.FC = () => {
)}
{route.data.flow && (
<>
{useStore.getState().canUserEditTeam(route.data.team) ? (
{useStore.getState().canUserEditTeam(team.slug) ? (
<Edit />
) : (
<Visibility />
Expand Down Expand Up @@ -400,9 +400,10 @@ const EditorToolbar: React.FC<{
}> = ({ headerRef, route }) => {
const { navigate } = useNavigation();
const [open, setOpen] = useState(false);
const [togglePreview, user] = useStore((state) => [
const [togglePreview, user, team] = useStore((state) => [
state.togglePreview,
state.getUser(),
state.getTeam(),
]);

const handleClose = () => {
Expand Down Expand Up @@ -506,7 +507,7 @@ const EditorToolbar: React.FC<{
)}

{/* Only show global settings link from top-level admin view */}
{!route.data.flow && !route.data.team && (
{!route.data.flow && !team.slug && (
<MenuItem onClick={() => navigate("/global-settings")}>
Global Settings
</MenuItem>
Expand Down

0 comments on commit 2ff3541

Please sign in to comment.