Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/OpportunityCards/OpportunityCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function OpportunityCards() {

{selectedTabIndex === 0 ? (
<Cards
url={`${urlApiOpportunity}`}
url={`${urlApiOpportunity}/legacy`} // external API endpoint for opportunity cards
opportunityParams={{
search: {
status: ["Volunteers Needed", "Search in process"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/AddOpportunity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function AddOpportunity() {
const { postRequest } = usePostRequest<
OpportunityParsedData,
Record<string, string | string[]>
>({ url: `${urlApi}/api/opportunity/` });
>({ url: `${urlApi}/api/opportunity/legacy` }); // external API endpoint for form submission

const formOpportunity = useForm<OpportunityData>({
defaultValues: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/BecomeVolunteer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function BecomeVolunteer() {
const { postRequest } = usePostRequest<
VolunteerParsedData,
Record<string, string | string[]>
>({ url: `${urlApi}/api/volunteer/` });
>({ url: `${urlApi}/api/volunteer/legacy` }); // external API endpoint for form submission

const opportunity: OpportunityInfo = {
id: opportunityParams.get("id") || "",
Expand Down
19 changes: 9 additions & 10 deletions src/components/forms/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
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 {
form: FormType;
}

export default function Form({ form }: Props) {
switch (form) {
case FormType.VOLUNTEER:
return <BecomeVolunteer />;
case FormType.OPPORTUNITY:
return <AddOpportunity />;
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;
}
Loading