fix(asset): use enka api for stores instead of github
Build and Deploy / build-and-deploy (push) Successful in 58s
Build and Deploy / build-and-deploy (push) Successful in 58s
This commit is contained in:
@@ -18,6 +18,7 @@ import type {
|
|||||||
import { ElementList } from "@/games/genshin/types/enka";
|
import { ElementList } from "@/games/genshin/types/enka";
|
||||||
import { Deduplicator } from "@/lib/dedupe";
|
import { Deduplicator } from "@/lib/dedupe";
|
||||||
import { createLogger } from "@/lib/logger";
|
import { createLogger } from "@/lib/logger";
|
||||||
|
import { throwNotOk } from "@/lib/util";
|
||||||
|
|
||||||
globalThis.devCache ??= new TTLCache();
|
globalThis.devCache ??= new TTLCache();
|
||||||
export const cache = globalThis.devCache;
|
export const cache = globalThis.devCache;
|
||||||
@@ -204,8 +205,8 @@ export async function getEnkaStore<K extends keyof StoreTypeMap>(
|
|||||||
|
|
||||||
log`Fresh: store.${key}`;
|
log`Fresh: store.${key}`;
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://github.com/EnkaNetwork/API-docs/raw/refs/heads/master/store/gi/${key}.json`,
|
`https://api.enka.network/store/gi/${key}.json`,
|
||||||
);
|
).then(throwNotOk);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
cache.set(`store.${key}`, data, 86400); // 24 hours
|
cache.set(`store.${key}`, data, 86400); // 24 hours
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
Reference in New Issue
Block a user