Implement caching in the patch_detector, consume the cache from API routes in frontend
15 lines
397 B
TypeScript
15 lines
397 B
TypeScript
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'
|
|
})
|
|
}
|
|
})
|