
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@jimengio/api-base
Advanced tools
公司项目 API 前端复用逻辑
包含功能:
注意事项
原先耦合的代码需要手动处理一遍, 搜则对应的逻辑会丢失:
EJimuApiEvent.ErrorUnauthorized
事件, 调用 clearUserInfoCache()
,EJimuApiEvent.ErrorMessage
事件, 调用 message.error(errorHumanized)
,EJimuApiEvent.ErrorGotoSignin
调用 gotoSignin(signinPath, location.href)
.yarn add @jimengio/api-base
import { get } from "@jimengio/api-base";
get({
baseURL: `http://my-api/api`,
url: `/info`,
});
// 发送其他方法
get({
method: "POST",
baseURL: `http://my-api/api`,
url: `/info`,
});
import { addGlobalErrorMessages } from "@jimengio/api-base";
addGlobalErrorMessages({
00001: "信息不合法",
});
对于特定的错误码定制错误信息(覆盖默认注册的错误信息):
put({
url: `/plants/${plantId}/materials/${materialId}`,
baseURL: coresBaseUrl,
data: options,
errorMessage: {
[ApiErrorCode.DBDup]: lingual.materialCodeAlreadyExists,
},
});
通过 false
可以关闭特定错误码的报错提示:
{
errorMessage: {
[ApiErrorCode.DBDup]: false,
},
}
通过 axios 的 paramsSerializer
的参数可以对数组格式的 query 参数进行格式化:
{
paramsSerializer: (params) => Qs.stringify(params, {arrayFormat: 'brackets'}),
}
import { EJimuApiEvent } from "@jimengio/api-base";
JimuApisEventBus.on(EJimuApiEvent.ErrorMessage, (error: string) => {
console.error(error);
});
export { changeApisLingual, EApisLangKind } from "@jimengio/api-base";
changeApisLingual(EApisLangKind.enUS);
展示网络加载进度(不精确):
import { NetProgress } from "@jimengio/api-base";
<NetProgress />;
get
post
put
del
patch
, 基础 HTTP 请求changeApisLingual
, EApisLangKind
用于修改多语言配置NetProgress
渲染网络状态的组件addGlobalErrorMessages
addGlobalStatusCodeErrorMessages
设置错误文案`ApiError
IJimuApiOption
API 属性配置类型BuiltinApiErrorCode
内置错误码, 偶尔会用到generateCancelToken
getApiBaseUrl
setApiBaseUrl
setApiDefaultHeader
API 状态修改方法globalErrorMessages
globalStatusCodeErrorMessages
(类型为 IErrorMessages
) 读取全局错误文案配置showError
触发错误FAQs
> 公司项目 API 前端复用逻辑
We found that @jimengio/api-base demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.