mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-30 22:13:45 +00:00
add example
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
Button,
|
||||
} from 'antd'
|
||||
const { api } = config
|
||||
const { dashboard, users, userLogin, user } = api
|
||||
const { dashboard, users, userLogin, user, v1test, v2test } = api
|
||||
|
||||
const requestOptions = [
|
||||
{
|
||||
@@ -77,7 +77,12 @@ const requestOptions = [
|
||||
}),
|
||||
},
|
||||
{
|
||||
url: '/test',
|
||||
url: v1test,
|
||||
desc: 'intercept request by mock.js',
|
||||
method: 'get',
|
||||
},
|
||||
{
|
||||
url: v2test,
|
||||
desc: 'intercept request by mock.js',
|
||||
method: 'get',
|
||||
},
|
||||
|
||||
+12
-8
@@ -1,3 +1,6 @@
|
||||
const APIV1 = '/api/v1'
|
||||
const APIV2 = '/api/v2'
|
||||
|
||||
module.exports = {
|
||||
name: 'AntD Admin',
|
||||
prefix: 'antdAdmin',
|
||||
@@ -5,18 +8,19 @@ module.exports = {
|
||||
logo: '/logo.png',
|
||||
iconFontCSS: '/iconfont.css',
|
||||
iconFontJS: '/iconfont.js',
|
||||
baseURL: '/api/v1',
|
||||
YQL: ['http://www.zuimeitianqi.com'],
|
||||
CORS: ['http://localhost:7000'],
|
||||
openPages: ['/login'],
|
||||
apiPrefix: '/api/v1',
|
||||
api: {
|
||||
userLogin: '/user/login',
|
||||
userLogout: '/user/logout',
|
||||
userInfo: '/userInfo',
|
||||
users: '/users',
|
||||
posts: '/posts',
|
||||
user: '/user/:id',
|
||||
dashboard: '/dashboard',
|
||||
userLogin: `${APIV1}/user/login`,
|
||||
userLogout: `${APIV1}/user/logout`,
|
||||
userInfo: `${APIV1}/userInfo`,
|
||||
users: `${APIV1}/users`,
|
||||
posts: `${APIV1}/posts`,
|
||||
user: `${APIV1}/user/:id`,
|
||||
dashboard: `${APIV1}/dashboard`,
|
||||
v1test: `${APIV1}/test`,
|
||||
v2test: `${APIV2}/test`,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
import { YQL, CORS, baseURL } from './config'
|
||||
import { YQL, CORS } from './config'
|
||||
import jsonp from 'jsonp'
|
||||
import lodash from 'lodash'
|
||||
import pathToRegexp from 'path-to-regexp'
|
||||
import { message } from 'antd'
|
||||
|
||||
axios.defaults.baseURL = baseURL
|
||||
|
||||
const fetch = (options) => {
|
||||
let {
|
||||
method = 'get',
|
||||
|
||||
Reference in New Issue
Block a user