- {items.map(item => {
- const isOthers = item.value === "others";
- const isChecked = item.checked;
- const otherItems = isInterest
- ? otherInterest
- : otherEndgoal;
- const setOtherItems = isInterest
- ? setOtherInterest
- : setOtherEndgoal;
-
- return (
-
handleChange(item.value, isInterest)}
- >
- {isChecked &&
}
- {isInterest ? (
-
-
-
{item.title}
-
- ) : (
-
{item.title}
- )}
- {isInterest && (
- <>
-
e.stopPropagation()}
- >
-
-
-
-
This category includes:
-
- {interestGroups[item.value]?.map(
- (group: InterestGroup) => (
- -
- {group.name}
-
- )
- )}
-
-
- >
- )}
- {isOthers && isChecked && (
-
e.stopPropagation()}>
- {
- if (e.target.value.length > 0) {
- setOtherItems([
- ...otherItems,
- e.target.value
- ]);
- e.target.value = "";
- }
- }}
- onChange={setOtherItems}
- name={`other_${
- isInterest
- ? "interests"
- : "endgoals"
- }`}
- placeHolder={`Specify your ${
- isInterest ? "interest" : "endgoal"
- }`}
- separators={
- isInterest ? [","] : undefined
- }
- />
-
- )}
-
+ if (interests.choosen_endgoals.length)
+ params.append("endgoals", interests.choosen_endgoals.join(","));
+ if (interests.other_endgoals?.length)
+ params.set(
+ "endgoals",
+ [params.get("endgoals"), interests.other_endgoals.join(",")]
+ .filter(Boolean)
+ .join(",")
+ );
+ if (ruri) params.append("ruri", ruri);
+
+ navigate(`/register?${params.toString()}`);
+ } else {
+ privateGateway
+ .post(onboardingRoutes.interests, interests)
+ .then(res => {
+ toast.success(res.data?.message.general[0]);
+ navigate(
+ ruri
+ ? ruri == "noredirect"
+ ? "/dashboard/profile"
+ : `/register/organization/?ruri=${ruri}`
+ : "/register/organization"
);
- })}
-
- ),
- [handleChange, interestGroups, otherInterest, otherEndgoal]
- );
-
- return (
- <>
-