correct issues
This commit is contained in:
@@ -23,6 +23,7 @@ const CustomDropdown = ({ items, selectedValue, onValueChange, placeholder = "Se
|
||||
const [open, setOpen] = useState(false);
|
||||
const selectedLabel = items.find((item:any) => item.value === selectedValue)?.label || placeholder;
|
||||
|
||||
|
||||
return (
|
||||
<View style={styles.dropdownWrapper}>
|
||||
<TouchableOpacity onPress={() => setOpen(true)} style={styles.dropdownHeader}>
|
||||
@@ -64,6 +65,8 @@ const CustomDropdown = ({ items, selectedValue, onValueChange, placeholder = "Se
|
||||
|
||||
const GroupDetails = () => {
|
||||
const route = useRoute<any>();
|
||||
|
||||
console.log(" route id : ", route)
|
||||
const [memberData, setMemberData] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
@@ -85,7 +88,7 @@ const GroupDetails = () => {
|
||||
|
||||
const getCycleDashboard = async () => {
|
||||
try {
|
||||
const response = await apiCall(`${BASE_URL}payments/groups/${group.id}/cycle-dashboard`, "GET") as any;
|
||||
const response = await apiCall(`${BASE_URL}payments/groups/${group.id || route?.params?.groupId}/cycle-dashboard`, "GET") as any;
|
||||
const responseData = response.data;
|
||||
setCycleDashboardData(responseData);
|
||||
|
||||
@@ -106,7 +109,7 @@ const GroupDetails = () => {
|
||||
|
||||
const fetchGroupDetails = async () => {
|
||||
try {
|
||||
const res = await apiCall(`${GROUP_ALL_MEMBER}?groupId=${group.id}`, "GET") as any;
|
||||
const res = await apiCall(`${GROUP_ALL_MEMBER}?groupId=${group.id || route?.params?.groupId}`, "GET") as any;
|
||||
console.log("Group Members Response: ", res);
|
||||
setMemberData(res.data);
|
||||
} catch (error: any) {
|
||||
@@ -116,7 +119,7 @@ const GroupDetails = () => {
|
||||
|
||||
const handleContribution = async () => {
|
||||
try {
|
||||
const res = await apiCall(`${CONTRIBUTE}${group.id}/calculate-contribution`, 'GET') as any;
|
||||
const res = await apiCall(`${CONTRIBUTE}${group.id || route?.params?.groupId}/calculate-contribution`, 'GET') as any;
|
||||
setPayable(res.data);
|
||||
} catch (error) {
|
||||
console.log("Error in handleContribution: ", error);
|
||||
@@ -131,13 +134,13 @@ const GroupDetails = () => {
|
||||
getCycleDashboard()
|
||||
]);
|
||||
setLoading(false);
|
||||
}, [group.id]);
|
||||
}, [group.id || route?.params?.groupId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (group.id) {
|
||||
if (group.id || route?.params?.groupId) {
|
||||
fetchAllData();
|
||||
}
|
||||
}, [group.id, fetchAllData]);
|
||||
}, [group.id || route?.params?.groupId, fetchAllData]);
|
||||
|
||||
const onRefresh = useCallback(async () => {
|
||||
setRefreshing(true);
|
||||
@@ -169,8 +172,8 @@ const GroupDetails = () => {
|
||||
}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
>
|
||||
<Header title={group.name} />
|
||||
<Text style={styles.description}>{group.description}</Text>
|
||||
<Header title={group.name || route.name} />
|
||||
<Text style={styles.description}>{group.description || route.name}</Text>
|
||||
|
||||
<View style={styles.statsRow}>
|
||||
<View style={styles.statBox}>
|
||||
@@ -180,7 +183,7 @@ const GroupDetails = () => {
|
||||
<View style={styles.statBox}>
|
||||
<Text style={styles.statValue}>₹{group.collected}</Text>
|
||||
<Text style={styles.statLabel}>Contribution</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.statBox}>
|
||||
<Text style={styles.statValue}>₹{group.goal}</Text>
|
||||
<Text style={styles.statLabel}>Total Amount</Text>
|
||||
|
||||
Reference in New Issue
Block a user