Skip to content

Commit

Permalink
Removed team redirect for cloud mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Nov 21, 2024
1 parent 9c2bfe8 commit 7803f72
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/app/(main)/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,25 @@ export function NavBar() {

const handleTeamChange = (teamId: string) => {
const url = teamId ? `/teams/${teamId}` : '/';
setItem('umami.team', { id: teamId });
if (!cloudMode) {
setItem('umami.team', { id: teamId });
}
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
};

useEffect(() => {
const teamIdLocal = getItem('umami.team')?.id;
if (teamIdLocal && pathname !== '/' && pathname !== '/dashboard') {
const url = '/';
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
} else if (teamIdLocal) {
const url = `/teams/${teamIdLocal}/dashboard`;
router.push(cloudMode ? `${process.env.cloudUrl}${url}` : url);
if (!cloudMode) {
const teamIdLocal = getItem('umami.team')?.id;

if (teamIdLocal && pathname !== '/' && pathname !== '/dashboard') {
const url = '/';
router.push(url);
} else if (teamIdLocal) {
const url = `/teams/${teamIdLocal}/dashboard`;
router.push(url);
}
}
}, []);
}, [cloudMode]);

return (
<div className={styles.navbar}>
Expand Down

0 comments on commit 7803f72

Please sign in to comment.