1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { HTTP } from 'vuejs/rest/http-axios'
- export default {
- namespaced: true,
- // initial state
- state : {
- isloggedin: false,
- username: '',
- token: null
- },
- // getters
- getters : {},
- // mutations
- mutations : {
- // setUser (state, posts) {
- // state.all = posts
- // }
- // setOpened (state, post) {
- // state.opened = post
- // },
- // clearOpened (state) {
- // state.opened = null
- // }
- },
- // actions
- actions : {
- getToken ({ commit, state }, data) {
- // console.log('getToken data', data)
- let config = {
- headers: {
- "Content-Type": "application/json"
- }
- }
- // console.log('data', data)
- // console.log('config', config)
- HTTP.post('/user/login?_format=json', data, config)
- .then(response => {
- console.log('response', response)
- // cb(response.data)
- })
- .catch(({ error }) => {
- console.log('Issue with login', error);
- Promise.reject(error);
- })
- }
- // ,
- // logout ({ commit }) {
- //
- // }
- }
- }
|