|
11 | 11 | <v-subheader>Name *</v-subheader>
|
12 | 12 | </v-col>
|
13 | 13 | <v-col cols="9">
|
14 |
| - <v-text-field v-model="state.selectedCurriculum.name" :error-messages="nameErrors" /> |
| 14 | + <v-text-field v-model="state.selectedCurriculum.name" /> |
15 | 15 | </v-col>
|
16 | 16 | </v-row>
|
17 | 17 | <v-row>
|
|
42 | 42 | </template>
|
43 | 43 |
|
44 | 44 | <script setup>
|
45 |
| -import { computed, toRefs } from 'vue' |
| 45 | +import { toRefs } from 'vue' |
| 46 | +
|
46 | 47 | import FormSections from './FormSections.vue'
|
| 48 | +import { useAuthStore } from '@/stores/auth' |
47 | 49 | import { useCurriculumStore } from '@/stores/curricula'
|
48 | 50 |
|
49 | 51 | const curriculumStore = useCurriculumStore()
|
| 52 | +const authStore = useAuthStore() |
| 53 | +const { user } = toRefs(authStore) |
50 | 54 |
|
51 | 55 | const { state } = toRefs(curriculumStore)
|
52 | 56 |
|
53 |
| -const nameErrors = computed(() => { |
54 |
| - const errors = [] |
55 |
| - if (!state.value.selectedCurriculum.value.name.$dirty) return errors |
56 |
| - !state.value.selectedCurriculum.value.name.maxLength && errors.push('Name must be at most 20 characters long.') |
57 |
| - !state.value.selectedCurriculum.value.name.required && errors.push('Name is required.') |
58 |
| - return errors |
59 |
| -}) |
60 |
| -
|
61 |
| -// const sectionNameErrors = (i) => { |
62 |
| -// const errors = [] |
63 |
| -// if (!sections.value[i].name.$dirty) return errors |
64 |
| -// !sections.value[i].name.maxLength && errors.push('Name must be at most 30 characters long.') |
65 |
| -// !sections.value[i].name.required && errors.push('Name is required.') |
66 |
| -// return errors |
67 |
| -// } |
68 |
| -
|
69 |
| -// const sectionUrlErrors = (i, type) => { |
70 |
| -// const errors = [] |
71 |
| -// if (!sections.value[i][`new${type}`].url.$model.length) return errors |
72 |
| -// !sections.value[i][`new${type}`].url.url && errors.push('Must be a valid url.') |
73 |
| -// return errors |
74 |
| -// } |
75 |
| -
|
76 | 57 | const submit = () => {
|
77 |
| - curriculumStore.patchCurriculum() |
| 58 | + state.value.selectedCurriculum.createdBy = user.value.id |
| 59 | + curriculumStore.postCurriculum() |
78 | 60 | }
|
79 | 61 | </script>
|
0 commit comments