@@ -67,8 +67,8 @@ import ModalView from '../ModalView.vue'
6767import RequestTaskDropdown from ' ../request-task/RequestTaskDropdown.vue'
6868import RequestTaskInput from ' ../request-task/RequestTaskInput.vue'
6969import { axiosInstance } from ' @/utils/axios'
70- import { getMainCategory , getSubCategory } from ' @/api/common'
71- import type { Category , CategoryForm , SubCategory } from ' @/types/common'
70+ import { getMainCategory } from ' @/api/common'
71+ import type { Category , CategoryForm } from ' @/types/common'
7272
7373const router = useRouter ()
7474const route = useRoute ()
@@ -146,24 +146,24 @@ onMounted(async () => {
146146 if (categoryStep === ' 1' ) {
147147 if (id ) {
148148 const mainCategories: Category [] = await getMainCategory ()
149- const initailValue = mainCategories .find (el => el .id === id )
150- if (initailValue ) {
151- categoryForm .value = { name: initailValue .name , code: initailValue .code }
149+ const initialValue = mainCategories .find (el => el .id === id )
150+ if (initialValue ) {
151+ categoryForm .value = { name: initialValue .name , code: initialValue .code }
152152 }
153153 }
154154 } else if (categoryStep === ' 2' ) {
155155 categoryOptions .value = await getMainCategory ()
156156 if (id ) {
157- const subCategory: SubCategory [] = await getSubCategory ()
158- const initailValue = subCategory .find (el => el .id === id )
159- if (initailValue ) {
157+ const { data : initialValue } = await axiosInstance .get (` /api/sub-categories/${id } ` )
158+ if (initialValue ) {
160159 categoryForm .value = {
161- name: initailValue .name ,
162- code: initailValue .code ,
163- mainCategoryId: initailValue .mainCategoryId
160+ name: initialValue .name ,
161+ code: initialValue .code ,
162+ mainCategoryId: initialValue .mainCategoryId ,
163+ descriptionExample: initialValue .descriptionExample
164164 }
165165 mainCategory .value =
166- categoryOptions .value .find (el => el .id === initailValue .mainCategoryId )?.name || ' '
166+ categoryOptions .value .find (el => el .id === initialValue .mainCategoryId )?.name || ' '
167167 }
168168 }
169169 }
0 commit comments