|
17 | 17 | <link href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css" rel="stylesheet" /> |
18 | 18 | <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js"></script> |
19 | 19 |
|
| 20 | + <!-- Add a reference to the Azure Maps Services Module JavaScript file. --> |
| 21 | + <script src="https://atlas.microsoft.com/sdk/javascript/service/2/atlas-service.min.js"></script> |
| 22 | + |
20 | 23 | <!-- Add a reference to the Azure Maps Rest Helper JavaScript file. --> |
21 | 24 | <script src="https://samples.azuremaps.com/lib/azure-maps/azure-maps-helper.min.js"></script> |
22 | 25 |
|
|
145 | 148 | //Add a layer for rendering data. |
146 | 149 | map.layers.add(new atlas.layer.BubbleLayer(datasource)); |
147 | 150 | }); |
| 151 | + |
| 152 | + //Use MapControlCredential to share authentication between a map control and the service module. |
| 153 | + var pipeline = atlas.service.MapsURL.newPipeline(new atlas.service.MapControlCredential(map)); |
| 154 | + |
| 155 | + //Create an instance of the SearchURL client. |
| 156 | + searchURL = new atlas.service.SearchURL(pipeline); |
148 | 157 | } |
149 | 158 |
|
150 | 159 | var searchMethod; |
|
207 | 216 | var requestUrl = 'https://{azMapsDomain}/search/address/batch/sync/json?api-version=1.0'; |
208 | 217 | var res = await processPostRequest(requestUrl, body); |
209 | 218 |
|
210 | | - var r = await res.json(); |
211 | | - |
212 | 219 | //Process the response. |
213 | | - processBatchResponse(r); |
| 220 | + processBatchResponse(res); |
214 | 221 |
|
215 | 222 | //Done. |
216 | 223 | endSearch(); |
|
222 | 229 | var requestUrl = 'https://{azMapsDomain}/search/address/batch/json?api-version=1.0'; |
223 | 230 | var res = await processPostRequest(requestUrl, body); |
224 | 231 |
|
225 | | - //Ge tthe batch status URL from the "location" response header. |
| 232 | + //Get the batch status URL from the "location" response header. |
226 | 233 | var batchStatusUrl = res.headers.get('location'); |
| 234 | + var signedRequest = await signRequest(requestUrl); |
227 | 235 |
|
228 | | - //Check the statuc of the batch job. |
| 236 | + //Check the status of the batch job. |
229 | 237 | var res2 = await fetch(batchStatusUrl, { |
230 | | - headers: new Headers(requestParams.headers) |
| 238 | + headers: new Headers(signedRequest.headers) |
231 | 239 | }); |
232 | 240 |
|
233 | 241 | //Check to see if batch process if complete. |
|
0 commit comments