Skip to content

Commit df03366

Browse files
committed
♻️ [refactor] : 이메일을 포함해 회원 수정
1 parent 58ad762 commit df03366

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/api/admin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ export const getMemberDetailAdmin = async (id: string) => {
4646
}
4747

4848
export const updateMemberAdmin = async (id: string, data: UserUpdateValue) => {
49-
const response = await axiosInstance.post(`api/managements/members/${id}`, data)
49+
const response = await axiosInstance.patch(`api/managements/members/${id}`, data)
5050
return response.data
5151
}

src/components/user-manage/UserUpdate.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ onMounted(async () => {
8989
if (typeof userId.value === 'string') {
9090
userData.value = await getMemberDetailAdmin(userId.value)
9191
}
92-
if (userData.value) {
93-
if (userData.value.role in RoleMapping) {
94-
userRegistrationForm.value = {
95-
...userData.value,
96-
role: RoleMapping[userData.value.role as keyof typeof RoleMapping]
97-
}
92+
if (userData.value && userData.value.role in RoleMapping) {
93+
userRegistrationForm.value = {
94+
...userData.value,
95+
role: RoleMapping[userData.value.role as keyof typeof RoleMapping]
9896
}
9997
}
10098
})
@@ -109,7 +107,7 @@ const handleSubmit = async () => {
109107
if (typeof userId.value === 'string') {
110108
const userData = {
111109
role: RoleTypeMapping[userRegistrationForm.value.role],
112-
email: null,
110+
email: userRegistrationForm.value.email,
113111
name: userRegistrationForm.value.name,
114112
isReviewer: userRegistrationForm.value.isReviewer,
115113
departmentId: userRegistrationForm.value.departmentId,
@@ -118,7 +116,7 @@ const handleSubmit = async () => {
118116
console.log(userData, '수정할 데이터')
119117
console.log(userId.value, '수정할 아이디')
120118
await updateMemberAdmin(userId.value, userData)
119+
isModalVisible.value = true
121120
}
122-
isModalVisible.value = true
123121
}
124122
</script>

src/types/admin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export interface UserRegistrationApiProps {
118118

119119
export interface UserUpdateValue {
120120
name: string
121-
email: null
121+
email: string
122122
isReviewer: boolean
123123
departmentId: number
124124
role: RoleTypesEnum

0 commit comments

Comments
 (0)