diff --git a/app/containers/AddProfile/index.js b/app/containers/AddProfile/index.js index 2b0a260..edb8fd6 100644 --- a/app/containers/AddProfile/index.js +++ b/app/containers/AddProfile/index.js @@ -38,6 +38,18 @@ const AddProfile = () => { const { data: ssidProfiles, fetchMore } = useQuery(GET_ALL_PROFILES(), { variables: { customerId, type: 'ssid' }, }); + const { data: radiusProfiles, fetchMore: fetchMoreRadiusProfiles } = useQuery( + GET_ALL_PROFILES(), + { + variables: { customerId, type: 'radius' }, + } + ); + const { data: captiveProfiles, fetchMore: fetchMoreCaptiveProfiles } = useQuery( + GET_ALL_PROFILES(), + { + variables: { customerId, type: 'captive_portal' }, + } + ); const { data: venueProfiles, fetchMore: fetchMoreVenueProfiles } = useQuery(GET_ALL_PROFILES(), { variables: { customerId, type: 'passpoint_venue' }, }); @@ -102,6 +114,42 @@ const AddProfile = () => { return true; }; + const handleFetchRadiusProfiles = e => { + if (radiusProfiles.getAllProfiles.context.lastPage) { + return false; + } + + e.persist(); + const { target } = e; + + if (target.scrollTop + target.offsetHeight === target.scrollHeight) { + fetchMoreRadiusProfiles({ + variables: { context: { ...radiusProfiles.getAllProfiles.context } }, + updateQuery: updateQueryGetAllProfiles, + }); + } + + return true; + }; + + const handleFetchCaptiveProfiles = e => { + if (captiveProfiles.getAllProfiles.context.lastPage) { + return false; + } + + e.persist(); + const { target } = e; + + if (target.scrollTop + target.offsetHeight === target.scrollHeight) { + fetchMoreCaptiveProfiles({ + variables: { context: { ...captiveProfiles.getAllProfiles.context } }, + updateQuery: updateQueryGetAllProfiles, + }); + } + + return true; + }; + const handleFetchVenueProfiles = e => { if (venueProfiles.getAllProfiles.context.lastPage) { return false; @@ -177,14 +225,16 @@ const AddProfile = () => { return (