axios plugin

This commit is contained in:
Jörn-Michael Miehe 2019-05-07 18:03:40 +02:00
parent 640cfe3b03
commit aac6b5e7b4
4 changed files with 9 additions and 10 deletions

View file

@ -27,6 +27,7 @@
<script> <script>
import FormDialog from './FormDialog.vue' import FormDialog from './FormDialog.vue'
import * as Cookies from 'js-cookie' import * as Cookies from 'js-cookie'
import axios from '@/plugins/axios'
export default { export default {
name: 'LoginForm', name: 'LoginForm',
@ -43,7 +44,7 @@ export default {
methods: { methods: {
confirm() { confirm() {
window.pkgs.axios axios
.post('/user/login', { .post('/user/login', {
session: Cookies.get('session'), session: Cookies.get('session'),
login: this.login, login: this.login,

View file

@ -38,6 +38,7 @@
<script> <script>
import FormDialog from './FormDialog.vue' import FormDialog from './FormDialog.vue'
import axios from '@/plugins/axios'
export default { export default {
name: 'RegisterForm', name: 'RegisterForm',
@ -67,7 +68,7 @@ export default {
methods: { methods: {
confirm() { confirm() {
window.pkgs.axios axios
.post('/user/register', { .post('/user/register', {
session: null, session: null,
login: this.login, login: this.login,

View file

@ -5,14 +5,6 @@ import router from './router'
import 'roboto-fontface/css/roboto/roboto-fontface.css' import 'roboto-fontface/css/roboto/roboto-fontface.css'
import 'material-design-icons-iconfont/dist/material-design-icons.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 Vue.config.productionTip = false
new Vue({ new Vue({

View file

@ -0,0 +1,5 @@
import axios from 'axios'
axios.defaults.baseURL =
window.location.protocol + '//' + window.location.hostname + ':3001'
export default axios