You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users.js 398B

1234567891011121314151617181920212223
  1. import axios from 'axios';
  2. export default {
  3. namespaced: true,
  4. state: {
  5. user: null,
  6. },
  7. mutations: {
  8. updateCurrentUser(state, user) {
  9. state.user = user;
  10. },
  11. },
  12. getters: {},
  13. actions: {
  14. signIn({
  15. commit,
  16. }) {
  17. axios.post('/api/user/login')
  18. .then(result => commit('updateCurrentUser', result.data))
  19. .catch(console.error);
  20. },
  21. },
  22. };