Skip to content

Commit

Permalink
feat: add umi-uni18n (ant-design#4814)
Browse files Browse the repository at this point in the history
* add umi-uni18n

fix ts error

* style: change script name

* change package name

* remove fetch-blocks
  • Loading branch information
chenshuai2144 authored Jul 19, 2019
1 parent ddaa3e6 commit 122edaf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
5 changes: 4 additions & 1 deletion mock/notices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const getNotices = (req, res) =>
import { Request, Response } from 'express';

const getNotices = (req: Request, res: Response) => {
res.json([
{
id: '000000001',
Expand Down Expand Up @@ -96,6 +98,7 @@ const getNotices = (req, res) =>
type: 'event',
},
]);
};

export default {
'GET /api/notices': getNotices,
Expand Down
13 changes: 7 additions & 6 deletions mock/user.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Request, Response } from 'express';
// 代码中会兼容本地 service mock 以及部署站点的静态数据
export default {
// 支持值为 Object 和 Array
Expand Down Expand Up @@ -72,7 +73,7 @@ export default {
address: 'Sidney No. 1 Lake Park',
},
],
'POST /api/login/account': (req, res) => {
'POST /api/login/account': (req: Request, res: Response) => {
const { password, userName, type } = req.body;
if (password === 'ant.design' && userName === 'admin') {
res.send({
Expand All @@ -96,10 +97,10 @@ export default {
currentAuthority: 'guest',
});
},
'POST /api/register': (req, res) => {
'POST /api/register': (req: Request, res: Response) => {
res.send({ status: 'ok', currentAuthority: 'user' });
},
'GET /api/500': (req, res) => {
'GET /api/500': (req: Request, res: Response) => {
res.status(500).send({
timestamp: 1513932555104,
status: 500,
Expand All @@ -108,7 +109,7 @@ export default {
path: '/base/category/list',
});
},
'GET /api/404': (req, res) => {
'GET /api/404': (req: Request, res: Response) => {
res.status(404).send({
timestamp: 1513932643431,
status: 404,
Expand All @@ -117,7 +118,7 @@ export default {
path: '/base/category/list/2121212',
});
},
'GET /api/403': (req, res) => {
'GET /api/403': (req: Request, res: Response) => {
res.status(403).send({
timestamp: 1513932555104,
status: 403,
Expand All @@ -126,7 +127,7 @@ export default {
path: '/base/category/list',
});
},
'GET /api/401': (req, res) => {
'GET /api/401': (req: Request, res: Response) => {
res.status(401).send({
timestamp: 1513932555104,
status: 401,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
"docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up",
"docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro",
"docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro",
"fetch:blocks": "fetch-blocks",
"fetch:blocks": "pro fetch-blocks",
"format-imports": "import-sort --write '**/*.{js,jsx,ts,tsx}'",
"functions:build": "netlify-lambda build ./lambda",
"functions:run": "cross-env NODE_ENV=dev netlify-lambda serve ./lambda",
"gh-pages": "cp CNAME ./dist/ && gh-pages -d dist",
"i18n-remove": "pro i18n-remove --locale=zh-CN --write",
"lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
"lint-staged": "lint-staged",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ",
Expand Down Expand Up @@ -82,7 +83,9 @@
},
"devDependencies": {
"@ant-design/colors": "^3.1.0",
"@ant-design/pro-cli": "^1.0.0",
"@types/classnames": "^2.2.7",
"@types/express": "^4.17.0",
"@types/history": "^4.7.2",
"@types/jest": "^24.0.13",
"@types/lodash": "^4.14.133",
Expand All @@ -98,7 +101,6 @@
"enzyme": "^3.9.0",
"eslint": "^5.16.0",
"express": "^4.17.1",
"fetch-blocks": "^1.0.0",
"gh-pages": "^2.0.1",
"husky": "^3.0.0",
"import-sort-cli": "^6.0.0",
Expand Down Expand Up @@ -162,3 +164,4 @@
]
}
}

0 comments on commit 122edaf

Please sign in to comment.