{"size": 1269, "ext": "js", "max_stars_repo_path": "src/others/apis.js", "max_stars_repo_name": "pmb2020/alone-admin", "max_stars_repo_stars_event_min_datetime": "2020-06-18T07:19:34.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-15T07:45:38.000Z", "max_issues_repo_path": "src/others/apis.js", "max_issues_repo_name": "pmb2020/alone-admin", "max_issues_repo_issues_event_min_datetime": "2021-01-09T16:20:10.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-26T12:03:52.000Z", "max_forks_repo_path": "src/others/apis.js", "max_forks_repo_name": "pmb2020/alone-admin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 23.5, "max_line_length": 81, "alphanum_fraction": 0.6548463357}
import {
	get,
	post,
	put,
	del
} from './request.js'
import axios from 'axios'

export const login= params=>post('/login',params);
export const logout= params=>get('/logout');
export const adminInfo = params => get('/admin', params)
export const userPost = params => post('http://www.alone.test/api/alone', params)
/**
 * 关于用户实体的四种操作（post增、get查、put改、删除delete）
 */
export const users = (method,params) => {
	return sendHttp('/user',params,method)
}
/**
 * 关于文章实体的四种操作
 */
export const article = (method,params) => {
	return sendHttp('/article',params,method)
}
// export const userPost=params =>put('http://www.alone.test/api/alone',params)
// export const article = params => get('/articles/article.json',params)
// export const article = params => {
// 	console.log(params.id)
// 	return get('/articles/article.json', params).then(res => {
// 		console.log(res)
// 		return res
// 	}).catch(err => {
// 		return err
// 	})
// }
/**
 * @param {Object} url
 * @param {Object} params
 * @param {Object} method
 * 封装的restful风格的http请求
 */
function sendHttp(url,params,method){
	switch (method) {
		case 'POST':
			return post(url, params);
		case 'PUT':
			return put(url, params);
		case 'DELETE':
			return del(url, params);
		default:
			return get(url, params);
	}
}
