File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 88 "lint" : " vue-cli-service lint"
99 },
1010 "dependencies" : {
11+ "axios" : " ^0.20.0" ,
1112 "core-js" : " ^3.6.5" ,
1213 "tailwindcss" : " ^1.8.10" ,
1314 "vee-validate" : " ^3.3.11" ,
Original file line number Diff line number Diff line change 11import Vue from 'vue' ;
22import { ValidationProvider , ValidationObserver , extend } from 'vee-validate/dist/vee-validate.full.esm' ;
3+ import http from './plugins/http' ;
34import App from './App.vue' ;
45import router from './router' ;
56import store from './store' ;
@@ -12,6 +13,8 @@ extend('validPassword', validPassword);
1213
1314Vue . config . productionTip = false ;
1415
16+ Vue . use ( http ) ;
17+
1518new Vue ( {
1619 router,
1720 store,
Original file line number Diff line number Diff line change 1+ import Axios from 'axios' ;
2+ import Vue from 'vue' ;
3+
4+ function createAxiosInstance ( baseURL ) {
5+ return Axios . create ( {
6+ baseURL,
7+ headers : {
8+ 'Content-Type' : 'application/json' ,
9+ Authorization : `Bearer ${ localStorage . token } ` ,
10+ } ,
11+ } ) ;
12+ }
13+
14+ const axiosInstance = createAxiosInstance ( 'http://localhost:8080' ) ;
15+
16+ export default {
17+ install ( ) {
18+ Vue . prototype . $http = axiosInstance ;
19+ } ,
20+ } ;
Original file line number Diff line number Diff line change @@ -1870,6 +1870,13 @@ aws4@^1.8.0:
18701870 resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.1.tgz#e1e82e4f3e999e2cfd61b161280d16a111f86428"
18711871 integrity sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==
18721872
1873+ axios@^0.20.0 :
1874+ version "0.20.0"
1875+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.20.0.tgz#057ba30f04884694993a8cd07fa394cff11c50bd"
1876+ integrity sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==
1877+ dependencies :
1878+ follow-redirects "^1.10.0"
1879+
18731880babel-eslint@^10.1.0 :
18741881 version "10.1.0"
18751882 resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232"
@@ -4076,7 +4083,7 @@ flush-write-stream@^1.0.0:
40764083 inherits "^2.0.3"
40774084 readable-stream "^2.3.6"
40784085
4079- follow-redirects@^1.0.0 :
4086+ follow-redirects@^1.0.0, follow-redirects@^1.10.0 :
40804087 version "1.13.0"
40814088 resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
40824089 integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==
You can’t perform that action at this time.
0 commit comments