Li Jun
2022-03-17 3d29090cfcde7bfb1b72de7e9d470a6a32931f3a
force-app/main/default/pages/SearchLeadPage.page
@@ -1,5 +1,6 @@
<apex:page controller="SearchLeadController" showHeader="false" id="page">
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <head>
    </head>
@@ -48,20 +49,27 @@
                let requestSearchPayload = preparePayloadForSearchLead();
                console.log('request payload body:'+requestSearchPayload);
                //2. Invoke AWS Service
                fetch(staticResources.searchUrl, {
                    method: 'POST',
                    body: requestSearchPayload,
                    headers: {
                        'Content-Type': 'application/json',
                        'pi-token': staticResources.token
                    }
                }).then((data) => {
                    return data.json();
                }).then((result) => {
                // fetch(staticResources.searchUrl, {
                //     method: 'POST',
                //     body: requestSearchPayload,
                //     headers: {
                //         'Content-Type': 'application/json',
                //         'pi-token': staticResources.token
                //     }
                // }).then((data) => {
                //     return data.json();
                // }).then((result) => {
                //     if(result.object&&result.object.length>0){
                //         initContactTable(result);
                //     }
                // })
                let queryLeadBack = function(result){
                    if(result.object&&result.object.length>0){
                        initContactTable(result);
                    }
                })
                    }
                }
                AWSService.search(staticResources.searchUrl, requestSearchPayload, queryLeadBack, staticResources.token);
            }
            
            function redirectToParentPage(obj) {