api articles typing fix
This commit is contained in:
1 parent
5cbce648c4
commit
8c2b17150b
1 file changed
+7
-2
@@ -1,10 +1,15 @@
|
||||
import { findArticles } from '../../../src/server/articles'
|
||||
import { withMiddleware } from '../../../src/middlewares/withMiddleware'
|
||||
|
||||
const int = (value: string | string[]) => parseInt(Array.isArray(value)
|
||||
? value[0]
|
||||
: value
|
||||
)
|
||||
|
||||
export default withMiddleware(async (req, res) => {
|
||||
const { query } = req
|
||||
const page = parseInt(query.page)
|
||||
const pageSize = parseInt(query.pageSize)
|
||||
const page = int(query.page)
|
||||
const pageSize = int(query.pageSize)
|
||||
|
||||
const data = await findArticles(page, pageSize)
|
||||
|
||||
|
||||
Reference in new issue
Block a user