Commit 46ef3e60 by liguokang

feat: 🎨

parent 58976512
import Vue from 'vue';
import axios from 'axios';
import User from '../core/user';
import { load as cookieLoad, save as cookieSave } from 'react-cookies';
// 创建axios实例
let serverPath = window.CONFIG.server;
......@@ -16,7 +16,7 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(
(config) => {
if (config.url.indexOf('public/') === -1 && User.token()) {
if (config.url.indexOf('public/') === -1 && cookieLoad('token')) {
return config;
} else if (config.headers.module) {
const url = JSON.parse(JSON.stringify(config.url));
......@@ -118,9 +118,5 @@ function processHttpError(response) {
errorInfo: message,
path: response.config.url,
});
Vue.$wheatToast({
message: message,
position: 'middle',
});
}
export default service;
......@@ -2,13 +2,14 @@
* @Author: liguokang
* @Date: 2021-07-14 20:36:28
* @LastEditors: liguokang
* @LastEditTime: 2021-07-27 20:57:22
* @LastEditTime: 2021-07-29 14:43:14
* @Description:
* @Copyrigh: ©2021 杭州杰竞科技有限公司 版权所有
*/
const withLessExcludeAntd = require('./next-less.config.js');
const path = require('path');
const webpack = require('webpack');
if (typeof require !== 'undefined') {
require.extensions['.less'] = (file) => {};
......@@ -32,6 +33,13 @@ module.exports = withLessExcludeAntd({
config.resolve.alias['@'] = path.join(__dirname, 'common');
config.resolve.alias['components'] = path.join(__dirname, 'components');
config.resolve.alias['static'] = path.join(__dirname, 'static');
config.plugins.push(
new webpack.DefinePlugin({
'process.env': {
DEPLOY_ENV: JSON.stringify(process.env.DEPLOY_ENV),
},
}),
);
return config;
},
});
......@@ -2256,25 +2256,23 @@
}
},
"cross-env": {
"version": "5.2.1",
"resolved": "https://registry.nlark.com/cross-env/download/cross-env-5.2.1.tgz",
"integrity": "sha1-ssdsHKet1m3IdNEXmEZglPVRs00=",
"version": "7.0.3",
"resolved": "https://registry.nlark.com/cross-env/download/cross-env-7.0.3.tgz",
"integrity": "sha1-hlJkspZ33AFbqEGJGJZd0jL8VM8=",
"dev": true,
"requires": {
"cross-spawn": "^6.0.5"
"cross-spawn": "^7.0.1"
}
},
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-6.0.5.tgz",
"integrity": "sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q=",
"version": "7.0.3",
"resolved": "https://registry.nlark.com/cross-spawn/download/cross-spawn-7.0.3.tgz",
"integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY=",
"dev": true,
"requires": {
"nice-try": "^1.0.4",
"path-key": "^2.0.1",
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
}
},
"crypto-browserify": {
......@@ -5256,12 +5254,6 @@
}
}
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.nlark.com/nice-try/download/nice-try-1.0.5.tgz",
"integrity": "sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y=",
"dev": true
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.nlark.com/node-fetch/download/node-fetch-2.6.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.1.tgz",
......@@ -5775,9 +5767,9 @@
"dev": true
},
"path-key": {
"version": "2.0.1",
"resolved": "https://registry.nlark.com/path-key/download/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"version": "3.1.1",
"resolved": "https://registry.nlark.com/path-key/download/path-key-3.1.1.tgz",
"integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=",
"dev": true
},
"path-parse": {
......@@ -7323,18 +7315,18 @@
"integrity": "sha1-GI1SHelbkIdAT9TctosT3wrk5/g="
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"version": "2.0.0",
"resolved": "https://registry.nlark.com/shebang-command/download/shebang-command-2.0.0.tgz",
"integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=",
"dev": true,
"requires": {
"shebang-regex": "^1.0.0"
"shebang-regex": "^3.0.0"
}
},
"shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-3.0.0.tgz",
"integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=",
"dev": true
},
"shell-quote": {
......@@ -8732,9 +8724,9 @@
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.nlark.com/which/download/which-1.3.1.tgz",
"integrity": "sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo=",
"version": "2.0.2",
"resolved": "https://registry.nlark.com/which/download/which-2.0.2.tgz",
"integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=",
"dev": true,
"requires": {
"isexe": "^2.0.0"
......
......@@ -6,6 +6,10 @@
"build": "next build",
"export": "npm run build && next export",
"start": "next start",
"build:dev": "cross-env DEPLOY_ENV=dev npm run build",
"build:rc": "cross-env DEPLOY_ENV=rc npm run build",
"build:gray": "cross-env DEPLOY_ENV=gray npm run build",
"build:prod": "cross-env DEPLOY_ENV=prod npm run build",
"prepare": "husky install",
"precommit": "pretty-quick --staged"
},
......@@ -32,11 +36,12 @@
"@commitlint/config-conventional": "^13.1.0",
"@types/react": "^17.0.9",
"commitlint-config-cz": "^0.13.2",
"cross-env": "^5.2.0",
"cross-env": "^7.0.2",
"husky": "^7.0.1",
"lint-staged": "^11.1.1",
"prettier": "2.3.2",
"pretty-quick": "^3.1.1",
"react-cookies": "^0.1.1",
"typescript": "^4.3.2",
"webpack": "^4.37.0",
"webpack-bundle-analyzer": "^3.3.2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment