File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
components/task-management Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,14 @@ onMounted(async () => {
157157 }
158158 }
159159 } else if (categoryStep === ' 2' ) {
160- categoryOptions .value = await getMainCategory ()
160+ const mainCategories: Category [] = await getMainCategory ()
161+ categoryOptions .value = mainCategories
162+ if (! id ) {
163+ const mainCategoryId = ref (Number (route .query .mainCategoryId ))
164+ categoryForm .value .mainCategoryId = mainCategoryId .value
165+ mainCategory .value =
166+ categoryOptions .value .find (el => el .mainCategoryId === mainCategoryId .value )?.name || ' '
167+ }
161168 if (id ) {
162169 const { data : initialValue } = await axiosInstance .get (` /api/sub-categories/${id } ` )
163170 if (initialValue ) {
Original file line number Diff line number Diff line change 3939 </div >
4040 <div
4141 class =" category-management-line gap-1 justify-center cursor-pointer bg-white hover:bg-background-2"
42- @click =" MovetoAddSubCategory" >
42+ @click =" MovetoAddSubCategory(main.mainCategoryId) " >
4343 <CommonIcons :name =" plusIcon" />
4444 <p class =" text-xs text-disabled font-bold" >새 2차 카테고리 추가</p >
4545 </div >
@@ -80,7 +80,7 @@ const deleteCategory = async (id: number) => {
8080 closeModal ()
8181}
8282
83- const MovetoAddSubCategory = () => {
84- router .push (' /category-second' )
83+ const MovetoAddSubCategory = (id : number ) => {
84+ router .push (` /category-second?mainCategoryId=${ id } ` )
8585}
8686 </script >
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ const setInterceptors = (instance: AxiosInstance) => {
4444 response => response ,
4545 async error => {
4646 const { setError } = useErrorStore ( )
47- console . log ( error )
4847 if ( axios . isCancel ( error ) ) {
4948 setError ( '요청이 취소되었습니다:' , error . message )
5049 } else if ( error . response ) {
You can’t perform that action at this time.
0 commit comments