UNPKG

@modyo/cli

Version:

Modyo Command Line Interface

30 lines (28 loc) 695 B
/* eslint no-param-reassign: ["error", {"ignorePropertyModificationsFor": ["state"] }] */ import Vuex from 'vuex'; import axios from 'axios'; export default new Vuex.Store({ state: { greeting: 'Hello World', title: 'empty', }, mutations: { SET_NAME(state, name) { state.greeting = `Hello ${name}`; }, }, actions: { GET_NAME(context) { return new Promise((resolve, reject) => { axios.get('title_url') .then((response) => { context.commit('SET_NAME', response.data); resolve(response.data); }, (err) => { console.error(err); reject(err); }); }); }, }, });