feat: Add response code 400.
fix: Change the parameter naming of the get method to params.
This commit is contained in:
parent
1da5e8d573
commit
dff8862c75
@ -1,10 +1,10 @@
|
||||
import { defAxios as request } from '@/utils/http'
|
||||
|
||||
export function getPosts(data = {}) {
|
||||
export function getPosts(params = {}) {
|
||||
return request({
|
||||
url: '/posts',
|
||||
method: 'get',
|
||||
data,
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { defAxios as request } from '@/utils/http'
|
||||
|
||||
export function getUsers(data = {}) {
|
||||
export function getUsers(params = {}) {
|
||||
return request({
|
||||
url: '/users',
|
||||
method: 'get',
|
||||
data,
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,9 @@ export function repReject(error) {
|
||||
* TODO 此处可以根据后端返回的错误码自定义框架层面的错误处理
|
||||
*/
|
||||
switch (code) {
|
||||
case 400:
|
||||
message = message || '请求参数错误'
|
||||
break
|
||||
case 401:
|
||||
message = message || '登录已过期'
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user