form.ts 917 B

1234567891011121314151617181920212223242526272829303132333435
  1. import {formState} from '~/types/interfaces'
  2. import {FORM_STATUS} from "~/types/enums";
  3. export const state = () => ({
  4. formStatus: FORM_STATUS.EDIT,
  5. violations: [],
  6. readonly: false,
  7. dirty: false,
  8. showConfirmToLeave: false,
  9. goAfterLeave: null
  10. })
  11. export const mutations = {
  12. setViolations (state: formState, violations: Array<string>) {
  13. state.violations = violations
  14. },
  15. setReadOnly (state: formState, readonly: boolean) {
  16. state.readonly = readonly
  17. },
  18. setFormStatus (state: formState, formStatus: FORM_STATUS) {
  19. state.formStatus = formStatus
  20. },
  21. setDirty (state: formState, dirty: boolean) {
  22. state.dirty = dirty
  23. },
  24. setShowConfirmToLeave (state: formState, showConfirmToLeave: boolean) {
  25. state.showConfirmToLeave = showConfirmToLeave
  26. },
  27. setGoAfterLeave (state: formState, goAfterLeave: string) {
  28. state.goAfterLeave = goAfterLeave
  29. }
  30. }
  31. export const actions = {
  32. }