forked from rockbenben/ChatGPT-Shortcut
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: optimize heat map tracking logic for improved performance
- Loading branch information
1 parent
e4c7e33
commit 826e393
Showing
4 changed files
with
110 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import axios from "axios"; | ||
|
||
export async function fetchAllCopyCounts() { | ||
try { | ||
const response = await axios.get( | ||
"https://api-count.newzone.top/api/cards/allcounts" | ||
); | ||
const counts = response.data.reduce((acc, item) => { | ||
acc[item.card_id] = item.count; | ||
return acc; | ||
}, {}); | ||
return counts; | ||
} catch (error) { | ||
console.error("Error fetching all copy counts:", error); | ||
return {}; | ||
} | ||
} | ||
export async function updateCopyCount(cardId) { | ||
try { | ||
const response = await axios.post( | ||
`https://api-count.newzone.top/api/cards/${cardId}/copy` | ||
); | ||
const updatedCount = response.data.copyCount; | ||
return updatedCount; | ||
} catch (error) { | ||
console.error("Error updating copy count:", error); | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters