Merge pull request #134 from y574444354/fix/favorite-list-all-types
fix: favorite list route should respect type query parameter
This commit is contained in:
commit
be10194239
|
|
@ -3,6 +3,7 @@ import {
|
||||||
listFavoriteItems,
|
listFavoriteItems,
|
||||||
loadFavoriteItem,
|
loadFavoriteItem,
|
||||||
unloadFavoriteItem,
|
unloadFavoriteItem,
|
||||||
|
type FavoriteItemType,
|
||||||
} from '../../costrict/favorite/favorite.js'
|
} from '../../costrict/favorite/favorite.js'
|
||||||
import { notFound } from '../errors.js'
|
import { notFound } from '../errors.js'
|
||||||
|
|
||||||
|
|
@ -10,7 +11,8 @@ export function createFavoriteRoutes(): Hono {
|
||||||
return new Hono()
|
return new Hono()
|
||||||
.get('/global/favorite/skills', async c => {
|
.get('/global/favorite/skills', async c => {
|
||||||
try {
|
try {
|
||||||
const items = await listFavoriteItems('skill')
|
const type = c.req.query('type') as FavoriteItemType | undefined
|
||||||
|
const items = await listFavoriteItems(type)
|
||||||
return c.json({ success: true, items })
|
return c.json({ success: true, items })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = error instanceof Error ? error.message : String(error)
|
const message = error instanceof Error ? error.message : String(error)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user