🐛 노트북 선택창 필드명 불일치 수정

- note-editor.html: notebook.name → notebook.title 수정
- notes.html: 모든 notebook.name → notebook.title 수정
- note-editor.js: 디버깅 로그 추가하여 노트북 데이터 구조 확인

백엔드 API에서는 'title' 필드를 사용하는데 프론트엔드에서 'name' 필드를 참조하여
노트북 선택창이 빈칸으로 표시되는 문제 해결
This commit is contained in:
Hyungi Ahn
2025-09-02 16:41:37 +09:00
parent 0dc4e3523f
commit ea9f4dfaa9
3 changed files with 11 additions and 3 deletions

View File

@@ -85,7 +85,7 @@
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
<option value="">미분류</option>
<template x-for="notebook in availableNotebooks" :key="notebook.id">
<option :value="notebook.id" x-text="notebook.name"></option>
<option :value="notebook.id" x-text="notebook.title"></option>
</template>
</select>
</div>

View File

@@ -137,7 +137,7 @@
class="px-3 py-2 border border-blue-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm">
<option value="">노트북 선택...</option>
<template x-for="notebook in availableNotebooks" :key="notebook.id">
<option :value="notebook.id" x-text="notebook.name"></option>
<option :value="notebook.id" x-text="notebook.title"></option>
</template>
</select>
@@ -180,7 +180,7 @@
<option value="">전체</option>
<option value="unassigned">미분류</option>
<template x-for="notebook in availableNotebooks" :key="notebook.id">
<option :value="notebook.id" x-text="notebook.name"></option>
<option :value="notebook.id" x-text="notebook.title"></option>
</template>
</select>
</div>

View File

@@ -127,6 +127,14 @@ function noteEditorApp() {
// 임시: 직접 API 호출
this.availableNotebooks = await this.api.get('/notebooks/', { active_only: true });
console.log('📚 노트북 로드됨:', this.availableNotebooks.length, '개');
console.log('📚 노트북 데이터 상세:', this.availableNotebooks);
// 각 노트북의 필드 확인
if (this.availableNotebooks.length > 0) {
console.log('📚 첫 번째 노트북 필드:', Object.keys(this.availableNotebooks[0]));
console.log('📚 첫 번째 노트북 title:', this.availableNotebooks[0].title);
console.log('📚 첫 번째 노트북 name:', this.availableNotebooks[0].name);
}
} catch (error) {
console.error('노트북 로드 실패:', error);
this.availableNotebooks = [];