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
750 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. getCurrentUserRole(state) {
  9. return state.current.current_users_role || {}
  10. },
  11. canViewApproveButton(state) {
  12. const role = state.current.current_users_role
  13. return role && !role.is_annotator
  14. },
  15. getLink(state) {
  16. return state.current.pageLink
  17. }
  18. }
  19. export const mutations = {
  20. setCurrent(state, payload) {
  21. state.current = payload
  22. }
  23. }
  24. export const actions = {
  25. async setCurrentProject({ commit }, projectId) {
  26. try {
  27. const response = await this.$services.project.findById(projectId)
  28. commit('setCurrent', response)
  29. } catch (error) {
  30. throw new Error(error)
  31. }
  32. }
  33. }