Skip to content

Commit cb4868d

Browse files
committed
🐛 [fix] 관리자가 본인의 계정을 삭제하는 것 방지
1 parent 9b3f09b commit cb4868d

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/common/ModalView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</div>
2828

2929
<div
30-
v-if="type != 'inputType' && $slots.header"
30+
v-if="type != 'inputType' && $slots.body"
3131
class="flex text-sm font-semibold text-body justify-center whitespace-pre-wrap text-center">
3232
<slot name="body"></slot>
3333
</div>

src/components/member-management/MemberManagementListCard.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ import { useRouter } from 'vue-router'
5858
import ResultModal from '../common/ResultModal.vue'
5959
import ListCardTab from '../lists/ListCardTab.vue'
6060
import ModalView from '../common/ModalView.vue'
61+
import { useMemberStore } from '@/stores/member'
62+
import { storeToRefs } from 'pinia'
63+
import { useErrorStore } from '@/stores/error'
6164
6265
const roleContent = (role: Role) => {
6366
return role === 'ROLE_USER' ? '사용자' : role === 'ROLE_MANAGER' ? '담당자' : '관리자'
@@ -84,7 +87,14 @@ const isModalVisible = ref({
8487
})
8588
const resultModalType = ref('')
8689
const message = ref('')
90+
const memberStore = useMemberStore()
91+
const { info: myInfo } = storeToRefs(memberStore)
92+
const { setError } = useErrorStore()
8793
const toggleModal = (key: keyof typeof isModalVisible.value) => {
94+
if (key === 'delete' && info.nickname === myInfo.value.nickname) {
95+
setError('자신의 계정은\n삭제할 수 없습니다')
96+
return
97+
}
8898
isModalVisible.value = Object.fromEntries(
8999
Object.keys(isModalVisible.value).map(k => [k, k === key])
90100
) as typeof isModalVisible.value

0 commit comments

Comments
 (0)