fix navigate

This commit is contained in:
Vivian Phung 2024-02-28 23:52:37 -07:00
parent 4532a962d8
commit 5946755749
No known key found for this signature in database

View File

@ -7,7 +7,7 @@ import {
TemplateIconType, TemplateIconType,
} from 'components/shared/CustomIcon'; } from 'components/shared/CustomIcon';
import { Tag } from 'components/shared/Tag'; import { Tag } from 'components/shared/Tag';
import { useNavigate } from 'react-router-dom'; import { useNavigate, useParams } from 'react-router-dom';
import { useToast } from 'components/shared/Toast'; import { useToast } from 'components/shared/Toast';
import { cn } from 'utils/classnames'; import { cn } from 'utils/classnames';
@ -30,6 +30,7 @@ export const TemplateCard: React.FC<TemplateCardProps> = ({
}: TemplateCardProps) => { }: TemplateCardProps) => {
const { toast, dismiss } = useToast(); const { toast, dismiss } = useToast();
const navigate = useNavigate(); const navigate = useNavigate();
const { orgSlug } = useParams();
const handleClick = useCallback(() => { const handleClick = useCallback(() => {
if (template?.isComingSoon) { if (template?.isComingSoon) {
@ -41,7 +42,9 @@ export const TemplateCard: React.FC<TemplateCardProps> = ({
}); });
} }
if (isGitAuth) { if (isGitAuth) {
return navigate(`template?templateId=${template.id}`); return navigate(
`/${orgSlug}/projects/create/template?templateId=${template.id}`,
);
} }
return toast({ return toast({
id: 'connect-git-account', id: 'connect-git-account',