Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
aplus-axios
Advanced tools
二次封装了axios,提供了常用的方法get/post/put/delete/request方法,全局请求和响应拦截封装,token设置,多语言,项目简单配置,直接可以撸业务
//如果是根路径加 -w
pnpm install aplus-axios -S -w
//导入
import { defHttp as _defHttp, VAxios } from 'aplus-axios';
//post使用例子
defHttp.post(
{
url: Api,
params
},
{ successMessageMode: 'message', customSuccessMessage: '成功' }
);
//导入
import { defHttp as _defHttp } from 'aplus-axios';
const defHttp = _defHttp({
apiUrl: globSetting.apiUrl,
urlPrefix: urlPrefix,
useMessageHook: useMessage,
getToken: getToken,
setToken: userStore.setToken,
logout: userStore.logout,
getLocale: localeStore.getLocale
});
export declare class VAxios {
private axiosInstance;
private readonly options;
constructor(options: CreateAxiosOptions);
private createAxios;
private getTransform;
getAxios(): AxiosInstance;
configAxios(config: CreateAxiosOptions): void;
setHeader(headers: any): void;
private setupInterceptors;
uploadFile<T = any>(
config: AxiosRequestConfig,
params: UploadFileParams
): Promise<AxiosResponse<T, any>>;
supportFormData(config: AxiosRequestConfig): AxiosRequestConfig<any>;
get<T = any>(
config: AxiosRequestConfig,
options?: RequestOptions
): Promise<T>;
post<T = any>(
config: AxiosRequestConfig,
options?: RequestOptions
): Promise<T>;
put<T = any>(
config: AxiosRequestConfig,
options?: RequestOptions
): Promise<T>;
delete<T = any>(
config: AxiosRequestConfig,
options?: RequestOptions
): Promise<T>;
request<T = any>(
config: AxiosRequestConfig,
options?: RequestOptions
): Promise<T>;
}
目前支持中文和英文,内置了语言包,默认是中文
//导入
import { defHttp as _defHttp } from 'aplus-axios';
const defHttp = _defHttp({
//其他配置代码
getLocale: 'zh-CN'
});
FAQs
aplus reuse axios provide some methods
We found that aplus-axios demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.