history.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // import { REST } from 'api/rest-axios'
  2. import router from '../../router'
  3. export default {
  4. namespaced: true,
  5. router,
  6. // initial state
  7. state: {
  8. items: [],
  9. opened: false
  10. },
  11. // getters
  12. getters: {},
  13. // mutations
  14. mutations: {
  15. addItem (state, item) {
  16. state.items.push(item)
  17. },
  18. setOpened (state, opened) {
  19. state.opened = opened
  20. }
  21. },
  22. // actions
  23. actions: {
  24. addItem ({ dispatch, commit, state }, item) {
  25. console.log('history add item', item, router)
  26. commit('addItem', item)
  27. commit('setOpened', true)
  28. // router.push({
  29. // name: `editiontext`,
  30. // params: {
  31. // id: item.textId,
  32. // textid: item.uuid
  33. // }
  34. // })
  35. },
  36. navigateToItem ({ dispatch, commit, state }, item) {
  37. console.log('history navigate to item', item, router)
  38. // commit('addItem', item)
  39. router.push({
  40. name: `editiontext`,
  41. params: {
  42. id: item.textId,
  43. textid: item.uuid
  44. }
  45. })
  46. }
  47. }
  48. }