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.

36 lines
741 B

2 years ago
2 years ago
2 years ago
  1. export const state = () => ({
  2. current: {}
  3. })
  4. export const getters = {
  5. currentProject(state) {
  6. return state.current
  7. },
  8. project(state) {
  9. return state.current
  10. }
  11. }
  12. export const mutations = {
  13. setCurrent(state, payload) {
  14. state.current = {
  15. ...payload,
  16. canDefineCategory: payload.canDefineCategory,
  17. canDefineLabel: payload.canDefineLabel,
  18. canDefineRelation: payload.canDefineRelation,
  19. canDefineSpan: payload.canDefineSpan
  20. }
  21. }
  22. }
  23. export const actions = {
  24. async setCurrentProject({ commit }, projectId) {
  25. try {
  26. const project = await this.$services.project.findById(projectId)
  27. commit('setCurrent', project)
  28. } catch (error) {
  29. throw new Error(error)
  30. }
  31. }
  32. }