axios plugin
This commit is contained in:
parent
640cfe3b03
commit
aac6b5e7b4
4 changed files with 9 additions and 10 deletions
|
@ -27,6 +27,7 @@
|
|||
<script>
|
||||
import FormDialog from './FormDialog.vue'
|
||||
import * as Cookies from 'js-cookie'
|
||||
import axios from '@/plugins/axios'
|
||||
|
||||
export default {
|
||||
name: 'LoginForm',
|
||||
|
@ -43,7 +44,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
confirm() {
|
||||
window.pkgs.axios
|
||||
axios
|
||||
.post('/user/login', {
|
||||
session: Cookies.get('session'),
|
||||
login: this.login,
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
<script>
|
||||
import FormDialog from './FormDialog.vue'
|
||||
import axios from '@/plugins/axios'
|
||||
|
||||
export default {
|
||||
name: 'RegisterForm',
|
||||
|
@ -67,7 +68,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
confirm() {
|
||||
window.pkgs.axios
|
||||
axios
|
||||
.post('/user/register', {
|
||||
session: null,
|
||||
login: this.login,
|
||||
|
|
|
@ -5,14 +5,6 @@ import router from './router'
|
|||
import 'roboto-fontface/css/roboto/roboto-fontface.css'
|
||||
import 'material-design-icons-iconfont/dist/material-design-icons.css'
|
||||
|
||||
import axios from 'axios'
|
||||
axios.defaults.baseURL =
|
||||
window.location.protocol + '//' + window.location.hostname + ':3001'
|
||||
|
||||
window.pkgs = {
|
||||
axios: axios
|
||||
}
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
|
|
5
frontend/src/plugins/axios.js
Normal file
5
frontend/src/plugins/axios.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import axios from 'axios'
|
||||
|
||||
axios.defaults.baseURL =
|
||||
window.location.protocol + '//' + window.location.hostname + ':3001'
|
||||
export default axios
|
Reference in a new issue