Frontend updates: caching basic data (json) from CDragon
Implement caching in the patch_detector, consume the cache from API routes in frontend
This commit is contained in:
14
frontend/server/api/cdragon/champion-summary.ts
Normal file
14
frontend/server/api/cdragon/champion-summary.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { getChampionSummary } from '~/server/utils/cdragon-cache'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
try {
|
||||
const championSummary = await getChampionSummary()
|
||||
return championSummary
|
||||
} catch (error) {
|
||||
console.error('Error fetching champion summary:', error)
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
statusMessage: 'Failed to fetch champion summary'
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user