GET方法
URL参数拼接
axios.get('api/login/oauth2/code/github?code=' + code + '&state=' + state, {
timeout: 5000,
}).then(successHandler).catch(failHandler)
config
axios.get('api/login/oauth2/code/github', {
params: {
code,
state
},
timeout: 5000
}).then(successHandler).catch(failHandler)
POST方法
POST方法接受的data参数对象默认以JSON格式传输,URL Encoded格式可使用qs.stringify(object)
转化
URL Encoded参数格式
import qs from 'qs'
const user = {
name: 'a',
id: 2
}
const data = qs.stringify(user)
axios.post('api/formLogin', data).then(successHandler).catch(failHandler)
JSON参数格式
const data = {
userId,
corpusId,
corpusModeName
}
axios.post('api/completeCorpus', data).then(successHandler).catch(failHandler)
PREVIOUSSpring循环依赖解决方案
NEXT浏览器缓存