PaymentsPurchasesCompany.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* Actions*/
  2. import { INIT_COMPANY_USER } from '@/constants/actionTypes'
  3. /* Mutations*/
  4. import { SET_COMPANY_USER, SET_CURRENCY_COMPANY } from '@/constants/mutationTypes'
  5. const initialState = {
  6. company: [],
  7. currencyCompany: []
  8. }
  9. const state = {
  10. company: initialState.company,
  11. currencyCompany: initialState.currencyCompany
  12. }
  13. const getters = {
  14. /**
  15. * [company description]
  16. * @param {[type]} state [description]
  17. * @return {[type]} [description]
  18. */
  19. company ( state ) {
  20. return state.company
  21. },
  22. /**
  23. * [currencyCompany description]
  24. * @param {[type]} state [description]
  25. * @return {[type]} [description]
  26. */
  27. currencyCompany ( state ) {
  28. return state.currencyCompany
  29. }
  30. }
  31. const mutations = {
  32. /**
  33. * [company description]
  34. * @type {[type]}
  35. */
  36. [SET_COMPANY_USER] ( state, payload ){
  37. state.company = payload
  38. },
  39. /**
  40. * [currencyCompany description]
  41. * @type {[type]}
  42. */
  43. [SET_CURRENCY_COMPANY] (state, payload ) {
  44. state.currencyCompany = payload
  45. }
  46. }
  47. const actions = {
  48. /**
  49. * [INIT_COMPANY_USER]
  50. */
  51. [INIT_COMPANY_USER] ({ commit }, payload ) {
  52. commit(SET_COMPANY_USER, payload.company)
  53. commit(SET_CURRENCY_COMPANY, payload.currency)
  54. }
  55. }
  56. export default {
  57. state,
  58. getters,
  59. mutations,
  60. actions
  61. }