mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-04 03:58:11 +00:00
fix: caching z API GH
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ export default defineComponent({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
const stockData = await (await fetch('https://spythere.github.io/api/stockDataNew.json')).json();
|
const stockData = await (await fetch(`https://spythere.github.io/api/stockDataNew.json?t=${Math.floor(Date.now() / 60000)}`)).json();
|
||||||
|
|
||||||
this.store.stockData = stockData;
|
this.store.stockData = stockData;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
const readyStockJSONData: ResponseJSONData = await (
|
const readyStockJSONData: ResponseJSONData = await (
|
||||||
await fetch('https://spythere.github.io/api/readyStock.json')
|
await fetch(`https://spythere.github.io/api/readyStock.json?t=${Math.floor(Date.now() / 60000)}`)
|
||||||
).json();
|
).json();
|
||||||
|
|
||||||
if (!readyStockJSONData) {
|
if (!readyStockJSONData) {
|
||||||
|
|||||||
+16
-16
@@ -11,22 +11,22 @@ export default defineConfig({
|
|||||||
registerType: 'autoUpdate',
|
registerType: 'autoUpdate',
|
||||||
workbox: {
|
workbox: {
|
||||||
globPatterns: ['**/*.{js,css,html,png,svg,img}'],
|
globPatterns: ['**/*.{js,css,html,png,svg,img}'],
|
||||||
runtimeCaching: [
|
// runtimeCaching: [
|
||||||
{
|
// {
|
||||||
urlPattern: new RegExp(`^https://spythere.github.io/api\/.*`),
|
// urlPattern: new RegExp(`^https://spythere.github.io/api\/.*`),
|
||||||
handler: 'NetworkFirst',
|
// handler: 'NetworkFirst',
|
||||||
options: {
|
// options: {
|
||||||
cacheName: 'github-api-cache',
|
// cacheName: 'github-api-cache',
|
||||||
expiration: {
|
// expiration: {
|
||||||
maxEntries: 2,
|
// maxEntries: 2,
|
||||||
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
|
// maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
|
||||||
},
|
// },
|
||||||
cacheableResponse: {
|
// cacheableResponse: {
|
||||||
statuses: [0, 200],
|
// statuses: [0, 200],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
},
|
||||||
devOptions: {
|
devOptions: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user