mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 20:39:44 +01:00
Update redirects for teams.
This commit is contained in:
parent
1955166bdf
commit
f01073c46a
@ -70,7 +70,7 @@ if (trackerScriptName) {
|
|||||||
const redirects = [
|
const redirects = [
|
||||||
{
|
{
|
||||||
source: '/settings',
|
source: '/settings',
|
||||||
destination: cloudMode ? `${cloudUrl}/settings/websites` : '/settings/websites',
|
destination: '/settings/websites',
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -80,18 +80,32 @@ const redirects = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: '/teams/:id/settings',
|
source: '/teams/:id/settings',
|
||||||
destination: cloudMode ? `${cloudUrl}/teams/:id/settings` : '/teams/:id/settings/team',
|
destination: '/teams/:id/settings/team',
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (cloudMode && cloudUrl && disableLogin) {
|
if (cloudMode && cloudUrl) {
|
||||||
|
redirects.push({
|
||||||
|
source: '/settings/:path*',
|
||||||
|
destination: `${cloudUrl}/settings/:path*`,
|
||||||
|
permanent: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
redirects.push({
|
||||||
|
source: '/teams/:id/settings/:path*',
|
||||||
|
destination: `${cloudUrl}/teams/:id/settings/:path*`,
|
||||||
|
permanent: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (disableLogin) {
|
||||||
redirects.push({
|
redirects.push({
|
||||||
source: '/login',
|
source: '/login',
|
||||||
destination: cloudUrl,
|
destination: cloudUrl,
|
||||||
permanent: false,
|
permanent: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
|
@ -17,7 +17,7 @@ export function NavBar() {
|
|||||||
const { pathname } = useNavigation();
|
const { pathname } = useNavigation();
|
||||||
const { teamId, renderTeamUrl } = useTeamUrl();
|
const { teamId, renderTeamUrl } = useTeamUrl();
|
||||||
|
|
||||||
const cloudMode = Boolean(process.env.cloudMode);
|
const cloudMode = !!process.env.cloudMode;
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{ label: formatMessage(labels.dashboard), url: renderTeamUrl('/dashboard') },
|
{ label: formatMessage(labels.dashboard), url: renderTeamUrl('/dashboard') },
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import SettingsLayout from './SettingsLayout';
|
import SettingsLayout from './SettingsLayout';
|
||||||
|
|
||||||
export default function ({ children }) {
|
export default function ({ children }) {
|
||||||
|
if (process.env.cloudMode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return <SettingsLayout>{children}</SettingsLayout>;
|
return <SettingsLayout>{children}</SettingsLayout>;
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,11 @@ export function TeamsButton({ teamId }: { teamId: string }) {
|
|||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { router } = useNavigation();
|
const { router } = useNavigation();
|
||||||
const team = user?.teams?.find(({ id }) => id === teamId);
|
const team = user?.teams?.find(({ id }) => id === teamId);
|
||||||
|
const cloudMode = !!process.env.cloudMode;
|
||||||
|
|
||||||
const handleSelect = (close: () => void, id: Key) => {
|
const handleSelect = (close: () => void, id: Key) => {
|
||||||
if (id !== user.id) {
|
if (id !== user.id) {
|
||||||
router.push(`/teams/${id}`);
|
router.push(cloudMode ? `${process.env.cloudUrl}/teams/${id}` : `/teams/${id}`);
|
||||||
} else {
|
} else {
|
||||||
router.push('/');
|
router.push('/');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user