未验证 提交 09ca4674 编写于 作者: J Jiahao 提交者: GitHub

Remove deprecated `url.parse` (#8542)

This API is deprecated. Changed to WHATWG URL API using `new URLSearchParams`
上级 29556570
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import { parse } from 'url';
import { TableListItem, TableListParams } from '@/pages/TableList/data';
// mock tableListDataSource
......@@ -39,7 +38,7 @@ function getRule(req: Request, res: Response, u: string) {
realUrl = req.url;
}
const { current = 1, pageSize = 10 } = req.query;
const params = (parse(realUrl, true).query as unknown) as TableListParams;
const params = (new URLSearchParams(realUrl.split('?')[1]) as unknown) as TableListParams;
let dataSource = [...tableListDataSource].slice(
((current as number) - 1) * (pageSize as number),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册