feat(chat): 캐릭터 리스트, 추가/수정 폼, 배너

- response의 데이터 구조에 맞춰서 코드 수정
This commit is contained in:
Yu Sung
2025-08-12 21:09:08 +09:00
parent a3e82a81f8
commit ba248f7680
4 changed files with 119 additions and 61 deletions

View File

@@ -197,7 +197,9 @@
</v-avatar>
</v-col>
<v-col>
<div class="font-weight-medium">선택된 캐릭터: {{ selectedCharacter.name }}</div>
<div class="font-weight-medium">
선택된 캐릭터: {{ selectedCharacter.name }}
</div>
</v-col>
</v-row>
</v-alert>
@@ -356,8 +358,9 @@ export default {
try {
const response = await getCharacterBannerList(this.page);
if (response && response.data) {
const newBanners = response.data.content || [];
if (response && response.status === 200 && response.data && response.data.success === true) {
const data = response.data.data;
const newBanners = data.content || [];
this.banners = [...this.banners, ...newBanners];
// 더 불러올 데이터가 있는지 확인
@@ -458,8 +461,9 @@ export default {
try {
const response = await searchCharacters(this.searchKeyword);
if (response && response.data) {
this.searchResults = response.data.content || [];
if (response && response.status === 200 && response.data && response.data.success === true) {
const data = response.data.data;
this.searchResults = data.content || [];
this.searchPerformed = true;
}
} catch (error) {
@@ -482,19 +486,27 @@ export default {
try {
if (this.isEdit) {
// 배너 수정
await updateCharacterBanner({
const response = await updateCharacterBanner({
image: this.bannerForm.image,
characterId: this.selectedCharacter.id,
bannerId: this.bannerForm.bannerId
});
this.notifySuccess('배너가 수정되었습니다.');
if (response && response.status === 200 && response.data && response.data.success === true) {
this.notifySuccess('배너가 수정되었습니다.');
} else {
this.notifyError('배너 수정을 실패했습니다.');
}
} else {
// 배너 추가
await createCharacterBanner({
const response = await createCharacterBanner({
image: this.bannerForm.image,
characterId: this.selectedCharacter.id
});
this.notifySuccess('배너가 추가되었습니다.');
if (response && response.status === 200 && response.data && response.data.success === true) {
this.notifySuccess('배너가 추가되었습니다.');
} else {
this.notifyError('배너 추가를 실패했습니다.');
}
}
// 다이얼로그 닫고 배너 목록 새로고침
@@ -514,10 +526,14 @@ export default {
this.isSubmitting = true;
try {
await deleteCharacterBanner(this.selectedBanner.id);
this.notifySuccess('배너가 삭제되었습니다.');
this.showDeleteDialog = false;
this.refreshBanners();
const response = await deleteCharacterBanner(this.selectedBanner.id);
if (response && response.status === 200 && response.data && response.data.success === true) {
this.notifySuccess('배너가 삭제되었습니다.');
this.showDeleteDialog = false;
this.refreshBanners();
} else {
this.notifyError('배너 삭제에 실패했습니다.');
}
} catch (error) {
console.error('배너 삭제 오류:', error);
this.notifyError('배너 삭제에 실패했습니다.');
@@ -538,8 +554,12 @@ export default {
// 드래그 앤 드롭으로 순서 변경 후 API 호출
try {
const bannerIds = this.banners.map(banner => banner.id);
await updateCharacterBannerOrder(bannerIds);
this.notifySuccess('배너 순서가 변경되었습니다.');
const response = await updateCharacterBannerOrder(bannerIds);
if (response && response.status === 200 && response.data && response.data.success === true) {
this.notifySuccess('배너 순서가 변경되었습니다.');
} else {
this.notifyError('배너 순서 변경에 실패했습니다.');
}
} catch (error) {
console.error('배너 순서 변경 오류:', error);
this.notifyError('배너 순서 변경에 실패했습니다.');