feat: add service module; 🌟

新增: 数据服务模块;
This commit is contained in:
iczer
2020-07-15 19:15:23 +08:00
parent 3f742a4dc1
commit 3ff12474cd
5 changed files with 62 additions and 4 deletions

5
src/services/api.js Normal file
View File

@@ -0,0 +1,5 @@
// const BASE_URL = 'http://localhost:8080' your service base url
const BASE_URL = '' // mock base url
module.exports = {
LOGIN: `${BASE_URL}/login`
}

5
src/services/index.js Normal file
View File

@@ -0,0 +1,5 @@
import {login} from './user'
export {
login
}

17
src/services/user.js Normal file
View File

@@ -0,0 +1,17 @@
import {LOGIN} from '@/services/api'
import {request, METHOD} from '@/utils/request'
/**
* 登录服务
* @param name 账户名
* @param password 账户密码
* @returns {Promise<AxiosResponse<T>>}
*/
function login(name, password) {
return request(LOGIN, METHOD.POST, {
name: name,
password: password
})
}
export {login}