MCPcopy Create free account
hub / github.com/JacobLinCool/LeetCode-Stats-Card / fetch

Method fetch

packages/core/src/card.ts:51–68  ·  view source on GitHub ↗
(
        username: string,
        site: "us" | "cn",
        headers: Record<string, string>,
    )

Source from the content-addressed store, hash-verified

49 }
50
51 protected async fetch(
52 username: string,
53 site: "us" | "cn",
54 headers: Record<string, string>,
55 ): Promise<FetchedData> {
56 this.log("fetching", username, site);
57 const cache_key = `https://leetcode-stats-card.local/data-${username.toLowerCase()}-${site}`;
58 console.log("cache_key", cache_key);
59
60 if (cache_key in this.fetches) {
61 return this.fetches[cache_key];
62 }
63 this.fetches[cache_key] = this._fetch(username, site, headers, cache_key);
64 this.fetches[cache_key].finally(() => {
65 delete this.fetches[cache_key];
66 });
67 return this.fetches[cache_key];
68 }
69
70 protected async _fetch(
71 username: string,

Callers 2

generateMethod · 0.95
handleFunction · 0.80

Calls 2

logMethod · 0.95
_fetchMethod · 0.95

Tested by

no test coverage detected