Skip to content

Commit e4d4b7e

Browse files
committed
✨ [feat] : 2차 카테고리 수정 초기 정보 연결
1 parent 8e42e0b commit e4d4b7e

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

src/assets/styles.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,29 @@ body {
3838
@apply flex w-full py-3 font-bold border rounded items-center justify-center min-w-[138px];
3939
}
4040
.button-large-default {
41-
@apply button-large bg-white text-zinc-400 border-zinc-400;
41+
@apply button-large bg-white text-disabled border-border-1 hover:bg-background-2;
4242
}
4343
.button-large-red {
44-
@apply button-large bg-red-1 text-white border-red-1;
44+
@apply button-large bg-red-1 text-white border-red-1 hover:bg-[#D61E1E];
4545
}
4646
.button-large-primary {
47-
@apply button-large bg-primary1 text-white border-primary1;
47+
@apply button-large bg-primary1 text-white border-primary1 hover:bg-[#6D6EF0];
4848
}
4949

5050
.button-medium {
5151
@apply flex items-center justify-center rounded px-4 py-2 font-bold gap-1 text-xs cursor-pointer shrink-0;
5252
}
5353
.button-medium-primary {
54-
@apply button-medium bg-primary1 text-white;
54+
@apply button-medium bg-primary1 text-white hover:bg-[#6869DE];
5555
}
5656
.button-medium-secondary {
57-
@apply button-medium bg-white border border-primary1 text-primary1;
57+
@apply button-medium bg-white border border-primary1 text-primary1 hover:bg-background-2;
5858
}
5959
.button-medium-default {
60-
@apply button-medium bg-white border border-border-1 text-disabled;
60+
@apply button-medium bg-white border border-border-1 text-disabled hover:bg-background-2;
6161
}
6262
.button-medium-red {
63-
@apply button-medium bg-white border border-red-1 text-red-1;
63+
@apply button-medium bg-white border border-red-1 text-red-1 hover:bg-background-2;
6464
}
6565

6666
.button-small {

src/components/task-management/CategoryAdd.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ import ModalView from '../ModalView.vue'
6767
import RequestTaskDropdown from '../request-task/RequestTaskDropdown.vue'
6868
import RequestTaskInput from '../request-task/RequestTaskInput.vue'
6969
import { 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
7373
const router = useRouter()
7474
const 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
}

src/types/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface SubCategory {
2525
mainCategoryId: number
2626
name: string
2727
code: string
28+
descriptionExample: string
2829
}
2930

3031
export interface FilterCategoryProps {

0 commit comments

Comments
 (0)