Skip to content

Commit

Permalink
chore(result):use replaceParams
Browse files Browse the repository at this point in the history
  • Loading branch information
radiorz committed Jan 7, 2025
1 parent 055b693 commit f2fe165
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 50 deletions.
1 change: 0 additions & 1 deletion packages/result/lib/ResultFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import { get } from 'lodash';
import { ReuseResult, FinalResult, OriginResult, OriginToken, ResultFactory } from './ResultFactory.type';
import { optionsMerge } from '@tikkhun/utils-core';
// import { params } from './utils/params';
import { replaceParams } from '@tikkhun/utils-core';
const defaultResultFactoryOptions = {
messageMap: new Map<string, Record<string, any>>(),
Expand Down
2 changes: 1 addition & 1 deletion packages/result/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@types/lodash": "^4.17.13",
"lodash": "^4.17.21",
"@tikkhun/utils-core": "workspace: ^"
"@tikkhun/utils-core": "workspace:^"
},
"devDependencies": {
"@types/node": "^22.10.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/result/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resultFactory.addLocale('zh', {
user: {
sign_in: {
success: '登录成功',
error: '登录错误,原因为 {error}',
error: '登录,但错误,原因为 {error} ,上下文:{context}',
},
},
}); // 第一个添加的是默认语言
Expand All @@ -22,7 +22,7 @@ const result = resultFactory.createResult({
token: 'user.sign_in', // 业务链条 比如 ['user', 'login']
status: true, // 细分状态
// error: new Error('没事抛个错'), // 错误体 即代码中捕获的错误
payload: {}, // 其他的数据可以暂存在这里
payload: { context: { a: 1, b: 2, c: 3 } }, // 其他的数据可以暂存在这里
// 直接的输出者
});
console.log(`successResult`, result);
Expand Down
48 changes: 2 additions & 46 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f2fe165

Please sign in to comment.