Advertisement
Guest User

Untitled

a guest
Nov 9th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import axios from 'axios'
  4.  
  5. Vue.use(Vuex)
  6.  
  7. const store = () => new Vuex.Store({
  8.   state: {
  9.     results: []
  10.   },
  11.   actions: {
  12.     data ({ state, dispatch, commit }, username, password) {
  13.       axios.post(
  14.         'http://127.0.0.1/token',
  15.         {
  16.           username: username,
  17.           password: password
  18.         }
  19.       )
  20.         .then(
  21.           (res) => {
  22.             const results= res.data.token
  23.           }
  24.         )
  25.     }
  26.   }
  27. })
  28.  
  29. export default store
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement