Swap to v2 of the historical api
This commit is contained in:
		
							parent
							
								
									fa058cc64e
								
							
						
					
					
						commit
						0180e8a3b5
					
				| @ -6,7 +6,7 @@ export default async function fetchData(currentRegionSelection, currentTimeSelec | ||||
|     const resp = await fetch(urlBuilder(currentRegionSelection, currentTimeSelection, currentAggregateSelection)); | ||||
|     const respData = await resp.json(); | ||||
|     for (let i = 0, l = respData.length; i < l; i++) { | ||||
|         let datum = new Datum(Date.parse(respData[i]['time']), respData[i]['value']); | ||||
|         let datum = new Datum(Date.parse(respData[i][0]), respData[i][1]); | ||||
|         data.push(datum); | ||||
|     } | ||||
|     return data; | ||||
|  | ||||
| @ -8,7 +8,7 @@ | ||||
|         <link rel="preconnect" href="https://data.wowtoken.app"> | ||||
| 	    <link rel="dns-prefetch" href="https://data.wowtoken.app"> | ||||
|         <link rel="preload" href="https://data.wowtoken.app/v2/current/retail.json" as="fetch" type="application/json" crossorigin="anonymous"> | ||||
|         <link rel="preload" href="https://data.wowtoken.app/token/history/us/72h.json" as="fetch" type="application/json" crossorigin="anonymous"> | ||||
|         <link rel="preload" href="https://data.wowtoken.app/v2/relative/retail/us/72h.json" as="fetch" type="application/json" crossorigin="anonymous"> | ||||
|     </head> | ||||
|     <body> | ||||
|         <div class="flex-container"> | ||||
| @ -59,7 +59,7 @@ | ||||
|                             <label for="aggregate">Smoothing Function:</label> | ||||
|                             <select name="aggregate" id="aggregate"> | ||||
|                                 <option id='agg_none' value="none">None</option> | ||||
|                                 <option id='agg_davg' value="daily_mean">Daily Average</option> | ||||
|                                 <option id='agg_davg' value="avg">Daily Average</option> | ||||
|                             </select> | ||||
|                         </fieldset> | ||||
|                         <fieldset id="y-start-options"> | ||||
|  | ||||
| @ -1,8 +1,12 @@ | ||||
| export default function urlBuilder(currentRegionSelection, currentTimeSelection, currentAggregateSelection) { | ||||
|     let url = "https://data.wowtoken.app/token/history/"; | ||||
|     if (currentAggregateSelection !== 'none') { | ||||
|         url += `${currentAggregateSelection}/` | ||||
|     let url = "https://data.wowtoken.app/v2/"; | ||||
|     if (currentAggregateSelection !== '' && currentAggregateSelection !== 'none'){ | ||||
|         url += `math/${currentAggregateSelection}/retail/` | ||||
|     } | ||||
|     url += `${currentRegionSelection}/${currentTimeSelection}.json` | ||||
|     else { | ||||
|         url += `relative/retail/` | ||||
|     } | ||||
| 
 | ||||
|     url += `${currentRegionSelection}/${currentTimeSelection}.json`; | ||||
|     return url; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user