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>
|
<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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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({
|
||||||
|
|
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