refactor:change name=> fetch.js to request.js

This commit is contained in:
Pan 2017-11-07 13:55:57 +08:00
parent 5eda0685ed
commit 61deec548c
6 changed files with 14 additions and 14 deletions

View file

@ -1,7 +1,7 @@
import fetch from '@/utils/fetch' import request from '@/utils/request'
export function fetchList(query) { export function fetchList(query) {
return fetch({ return request({
url: '/article/list', url: '/article/list',
method: 'get', method: 'get',
params: query params: query
@ -9,14 +9,14 @@ export function fetchList(query) {
} }
export function fetchArticle() { export function fetchArticle() {
return fetch({ return request({
url: '/article/detail', url: '/article/detail',
method: 'get' method: 'get'
}) })
} }
export function fetchPv(pv) { export function fetchPv(pv) {
return fetch({ return request({
url: '/article/pv', url: '/article/pv',
method: 'get', method: 'get',
params: { pv } params: { pv }

View file

@ -1,11 +1,11 @@
import fetch from '@/utils/fetch' import request from '@/utils/request'
export function loginByUsername(username, password) { export function loginByUsername(username, password) {
const data = { const data = {
username, username,
password password
} }
return fetch({ return request({
url: '/login/login', url: '/login/login',
method: 'post', method: 'post',
data data
@ -13,14 +13,14 @@ export function loginByUsername(username, password) {
} }
export function logout() { export function logout() {
return fetch({ return request({
url: '/login/logout', url: '/login/logout',
method: 'post' method: 'post'
}) })
} }
export function getUserInfo(token) { export function getUserInfo(token) {
return fetch({ return request({
url: '/user/info', url: '/user/info',
method: 'get', method: 'get',
params: { token } params: { token }

View file

@ -1,7 +1,7 @@
import fetch from '@/utils/fetch' import request from '@/utils/request'
export function getToken() { export function getToken() {
return fetch({ return request({
url: '/qiniu/upload/token', // 假地址 自行替换 url: '/qiniu/upload/token', // 假地址 自行替换
method: 'get' method: 'get'
}) })

View file

@ -1,7 +1,7 @@
import fetch from '@/utils/fetch' import request from '@/utils/request'
export function userSearch(name) { export function userSearch(name) {
return fetch({ return request({
url: '/search/user', url: '/search/user',
method: 'get', method: 'get',
params: { name } params: { name }

View file

@ -105,7 +105,7 @@
<script> <script>
/* eslint-disable */ /* eslint-disable */
import {effectRipple, data2blob} from './utils'; import {effectRipple, data2blob} from './utils';
import fetch from 'utils/fetch'; import request from 'utils/request';
import langBag from './lang'; import langBag from './lang';
const mimes = { const mimes = {
'jpg': 'image/jpeg', 'jpg': 'image/jpeg',
@ -672,7 +672,7 @@
that.loading = 1; that.loading = 1;
that.setStep(3); that.setStep(3);
that.$emit('crop-success', createImgUrl, field, ki); that.$emit('crop-success', createImgUrl, field, ki);
fetch({ request({
url, url,
method: 'post', method: 'post',
data: fmData data: fmData