feat(character): 캐릭터 로드, 저장, 수정

- success가 true여야만 다음 행동을 하도록 처리
This commit is contained in:
Yu Sung
2025-08-07 21:37:09 +09:00
parent 062bb4f7b2
commit bbacab88c5

View File

@@ -922,19 +922,21 @@ export default {
image: null, image: null,
imageUrl: '', imageUrl: '',
isActive: true, isActive: true,
createdAt: '',
gender: '', gender: '',
age: '', age: '',
mbti: '', mbti: '',
worldView: '',
relationships: '',
personality: '',
speechPattern: '', speechPattern: '',
conversationStyle: '', conversationStyle: '',
appearance: '', appearance: '',
systemPrompt: '', systemPrompt: '',
tags: [], tags: [],
memories: [] memories: [],
relationships: [],
hobbies: [],
values: [],
goals: [],
personalities: [],
backgrounds: []
}, },
ageRules: [ ageRules: [
v => !!v || '나이를 입력하세요', v => !!v || '나이를 입력하세요',
@@ -1331,7 +1333,7 @@ export default {
const response = await getCharacter(id); const response = await getCharacter(id);
// API 응답에서 캐릭터 정보 설정 // API 응답에서 캐릭터 정보 설정
if (response && response.data) { if (response && response.success === true && response.data) {
const data = response.data; const data = response.data;
// 원본 데이터 저장 (깊은 복사) // 원본 데이터 저장 (깊은 복사)
@@ -1390,7 +1392,6 @@ export default {
if (this.isEdit) { if (this.isEdit) {
// 수정 시 변경된 필드만 전송 // 수정 시 변경된 필드만 전송
const changedData = this.getChangedFields(); const changedData = this.getChangedFields();
console.log('변경된 필드만 전송:', changedData);
response = await updateCharacter(changedData, this.character.image); response = await updateCharacter(changedData, this.character.image);
} else { } else {
// 신규 등록 시 ID 필드를 제외한 데이터 전송 // 신규 등록 시 ID 필드를 제외한 데이터 전송
@@ -1399,7 +1400,7 @@ export default {
response = await createCharacter(characterWithoutId); response = await createCharacter(characterWithoutId);
} }
if (response && response.data) { if (response && response.success === true && response.data) {
this.notifySuccess(this.isEdit ? '캐릭터가 수정되었습니다.' : '캐릭터가 등록되었습니다.'); this.notifySuccess(this.isEdit ? '캐릭터가 수정되었습니다.' : '캐릭터가 등록되었습니다.');
this.goBack(); this.goBack();
} else { } else {