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/summoner-spells.ts
Normal file
14
frontend/server/api/cdragon/summoner-spells.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { getSummonerSpells } from '~/server/utils/cdragon-cache'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
try {
|
||||
const summonerSpells = await getSummonerSpells()
|
||||
return summonerSpells
|
||||
} catch (error) {
|
||||
console.error('Error fetching summoner spells:', error)
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
statusMessage: 'Failed to fetch summoner spells'
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user