diff --git a/src/components/OpportunityCards/OpportunityCards.tsx b/src/components/OpportunityCards/OpportunityCards.tsx index adfac2e..7b4c150 100644 --- a/src/components/OpportunityCards/OpportunityCards.tsx +++ b/src/components/OpportunityCards/OpportunityCards.tsx @@ -90,7 +90,7 @@ export function OpportunityCards() { {selectedTabIndex === 0 ? ( - >({ url: `${urlApi}/api/opportunity/` }); + >({ url: `${urlApi}/api/opportunity/legacy` }); // external API endpoint for form submission const formOpportunity = useForm({ defaultValues: { diff --git a/src/components/forms/BecomeVolunteer/index.tsx b/src/components/forms/BecomeVolunteer/index.tsx index 6e9e822..28d7908 100644 --- a/src/components/forms/BecomeVolunteer/index.tsx +++ b/src/components/forms/BecomeVolunteer/index.tsx @@ -48,7 +48,7 @@ export default function BecomeVolunteer() { const { postRequest } = usePostRequest< VolunteerParsedData, Record - >({ url: `${urlApi}/api/volunteer/` }); + >({ url: `${urlApi}/api/volunteer/legacy` }); // external API endpoint for form submission const opportunity: OpportunityInfo = { id: opportunityParams.get("id") || "", diff --git a/src/components/forms/index.tsx b/src/components/forms/index.tsx index 0fb59c0..166a252 100644 --- a/src/components/forms/index.tsx +++ b/src/components/forms/index.tsx @@ -1,5 +1,6 @@ -import AddOpportunity from "./AddOpportunity"; -import BecomeVolunteer from "./BecomeVolunteer"; +import { Lang } from "need4deed-sdk"; +import { useTranslation } from "react-i18next"; +import { getExternalUrl } from "../../utils"; import { FormType } from "./types"; interface Props { @@ -7,12 +8,10 @@ interface Props { } export default function Form({ form }: Props) { - switch (form) { - case FormType.VOLUNTEER: - return ; - case FormType.OPPORTUNITY: - return ; - default: - return null; - } + const { i18n } = useTranslation(); + + // Redirect to the external form URL based on the current language and form type + const to = getExternalUrl(i18n.language as Lang, form); + window.location.replace(to); + return null; }