diff --git a/src/api/post/index.js b/src/api/post/index.js index e06f12b..d40a9a7 100644 --- a/src/api/post/index.js +++ b/src/api/post/index.js @@ -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, }) } diff --git a/src/api/user/index.js b/src/api/user/index.js index 55c7c5f..b12ed7f 100644 --- a/src/api/user/index.js +++ b/src/api/user/index.js @@ -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, }) } diff --git a/src/utils/http/interceptors.js b/src/utils/http/interceptors.js index 843bd75..6388807 100644 --- a/src/utils/http/interceptors.js +++ b/src/utils/http/interceptors.js @@ -52,6 +52,9 @@ export function repReject(error) { * TODO 此处可以根据后端返回的错误码自定义框架层面的错误处理 */ switch (code) { + case 400: + message = message || '请求参数错误' + break case 401: message = message || '登录已过期' break