From 1fab13e97b98bacd8e5613da00ac934dbfcd98d8 Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 6 Apr 2021 20:09:59 +0200 Subject: Forced cache in ship type id requests --- derelict.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/derelict.js b/derelict.js index 65acb7c..0329729 100644 --- a/derelict.js +++ b/derelict.js @@ -2,6 +2,7 @@ import * as THREE from 'https://unpkg.com/three@0.126.1/build/three.module.js' import { OrbitControls } from 'https://unpkg.com/three@0.126.1/examples/jsm/controls/OrbitControls.js' import { CSS2DRenderer, CSS2DObject } from 'https://unpkg.com/three@0.126.1/examples/jsm/renderers/CSS2DRenderer.js' +const ESI = "https://esi.evetech.net/latest" const SCALE = 10000 class SkirmishGrid { @@ -58,7 +59,7 @@ class Wreck { this.killmail = killmail this.domElement.className = 'wreck' const shipTypeId = this.killmail.victim.ship_type_id - fetch(`https://esi.evetech.net/latest/universe/types/${shipTypeId}/?datasource=tranquility`) // TODO: Cache it. + fetch(`${ESI}/universe/types/${shipTypeId}/?datasource=tranquility`, {cache: "force-cache"}) .then(response => response.json()) .then(typeId => this.domElement.dataset.label = typeId.name) this.domElement.appendChild(iconElement) @@ -144,7 +145,7 @@ function init() { fetch(url.searchParams.get("related") + ".json") .then(response => response.json()) .then(killmails => { - const url = km => `https://esi.evetech.net/latest/killmails/${km.id}/${km.hash}/?datasource=tranquility` + const url = km => `${ESI}/killmails/${km.id}/${km.hash}/?datasource=tranquility` const retrieve = km => fetch(url(km)).then(response => response.json()) return Promise.all(killmails.map(retrieve)) }) -- cgit v1.1