File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import request from '../utils/request' ;
1+ import request , { baseURL } from '../utils/request' ;
22
33// 验证码ID
44export async function captchaID ( ) {
@@ -7,7 +7,7 @@ export async function captchaID() {
77
88// 图形验证码
99export function captcha ( id ) {
10- return `/api /v1/login/captcha?id=${ id } ` ;
10+ return `${ baseURL } /v1/login/captcha?id=${ id } ` ;
1111}
1212
1313// 登录
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import { notification } from 'antd';
33import moment from 'moment' ;
44import store from './store' ;
55
6+ export const baseURL = '/api' ;
7+
68function checkAccessTokenExpires ( expiresAt ) {
79 const now = moment ( ) . unix ( ) ;
810 if ( expiresAt - now <= 0 ) {
@@ -23,7 +25,7 @@ async function getAccessToken() {
2325 if ( checkAccessTokenExpires ( tokenInfo . expires_at ) === 0 ) {
2426 return axios
2527 . request ( {
26- url : '/api/ v1/refresh_token' ,
28+ url : ` ${ baseURL } / v1/refresh_token` ,
2729 method : 'POST' ,
2830 headers : {
2931 Authorization : `${ tokenInfo . token_type } ${ tokenInfo . access_token } ` ,
@@ -44,7 +46,7 @@ async function getAccessToken() {
4446export default async function request ( url , options ) {
4547 let showNotify = true ;
4648 const opts = {
47- baseURL : '/api' ,
49+ baseURL,
4850 url,
4951 validateStatus ( ) {
5052 return true ;
You can’t perform that action at this time.
0 commit comments