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.
@bingoit/ajax
Advanced tools
定义了一些AJAX请求相关的方法;
npm install @bingoit/ajax --save
按需引入:
import {get, post} from '@bingoit/ajax'
方法调用:get(url, args)
全部引入:
import * as ajax from '@bingoit/ajax'
方法调用:ajax.get(url, args)
setNotLoginHandler
方法设置处理的方法;setTokenHandler
方法设置获取token的方法。setNotLoginHandler
设置未登录处理者setNotLoginStatus
设置未登录状态值setTokenHandler
设置获取token值的处理者setTokenHeaderName
设置token请求头的名称setTimeout
设置请求超时时间get
GET请求post
POST请求getAutoConvert
GET请求(请求参数驼峰参数转换为下划线参数名,响应内容下划线变量名转换为驼峰命名)postAutoConvert
POST请求(请求参数驼峰参数转换为下划线参数名,响应内容下划线变量名转换为驼峰命名)postFormData
POST提交表单数据(一般用在文件的提交,默认情况下,参数会按驼峰命名或下划线转换)requestList
请求列表的通用方法设置未登录处理者及未登录状态码:
在项目的main.js文件中设置:
import {setNotLoginHandler} from '@bingoit/ajax';
setNotLoginHandler(this, function () {
//未登录时执行的方法;如跳转到登录页面等
}, 10004);
说明: 第一个参数为当前对象;第二个参数为未登录时的处理方法;第三参数为未登录的状态码(由后端返回)。
设置获取token值的处理者及token请求头的名称: 在项目的main.js文件中设置:
import {setTokenHandler} from '@bingoit/ajax';
setTokenHandler(this, function () {
//这里调用获取token的方法并返回;如:
// return getToken();
}, 'X-Authorization-Token');
说明: 第一个参数为当前对象;第二个参数为提供获取token的方法;第三参数为token在请求头中的名称。
FAQs
通用的ajax请求方法
The npm package @bingoit/ajax receives a total of 0 weekly downloads. As such, @bingoit/ajax popularity was classified as not popular.
We found that @bingoit/ajax demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.