Disable website select for saved report. Fix delete website routing

This commit is contained in:
Francis Cao 2024-02-08 10:30:14 -08:00
parent 91e3dff7f5
commit 5ae04291af
6 changed files with 31 additions and 22 deletions

View file

@ -1,6 +1,6 @@
import { Button, Modal, ModalTrigger, ActionForm, useToasts } from 'react-basics';
import { useRouter } from 'next/navigation';
import { useMessages, useModified } from 'components/hooks';
import { useMessages, useModified, useTeamUrl } from 'components/hooks';
import WebsiteDeleteForm from './WebsiteDeleteForm';
import WebsiteResetForm from './WebsiteResetForm';
@ -9,6 +9,7 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?:
const router = useRouter();
const { showToast } = useToasts();
const { touch } = useModified();
const { teamId, renderTeamUrl } = useTeamUrl();
const handleReset = async () => {
showToast({ message: formatMessage(messages.saved), variant: 'success' });
@ -16,8 +17,13 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?:
};
const handleDelete = async () => {
touch('websites');
router.push('/settings/websites');
if (teamId) {
touch('teams:websites');
router.push(renderTeamUrl('/settings/websites'));
} else {
touch('websites');
router.push('/settings/websites');
}
};
return (