fix: 修復前端TypeScript類型錯誤,完成重命名統一

修復重命名過程中遺留的類型定義問題:
- 更新所有SimpleFlashcard類型引用為Flashcard
- 清理Next.js webpack快取解決編譯錯誤
- 確保前端服務正確連接到新的/api/flashcards端點

 前端重新編譯成功,所有類型錯誤已解決
 智能詞卡生成和保存功能現已完全正常

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
鄭沛軒 2025-09-24 01:47:02 +08:00
parent 9c3178d104
commit af45b5d3da
1 changed files with 5 additions and 5 deletions

View File

@ -57,7 +57,7 @@ class FlashcardsService {
}
// 簡化的詞卡方法
async getFlashcards(search?: string, favoritesOnly: boolean = false): Promise<ApiResponse<{ flashcards: SimpleFlashcard[], count: number }>> {
async getFlashcards(search?: string, favoritesOnly: boolean = false): Promise<ApiResponse<{ flashcards: Flashcard[], count: number }>> {
try {
const params = new URLSearchParams();
if (search) params.append('search', search);
@ -66,7 +66,7 @@ class FlashcardsService {
const queryString = params.toString();
const endpoint = `/flashcards${queryString ? `?${queryString}` : ''}`;
return await this.makeRequest<ApiResponse<{ flashcards: SimpleFlashcard[], count: number }>>(endpoint);
return await this.makeRequest<ApiResponse<{ flashcards: Flashcard[], count: number }>>(endpoint);
} catch (error) {
return {
success: false,
@ -75,7 +75,7 @@ class FlashcardsService {
}
}
async createFlashcard(data: CreateSimpleFlashcardRequest): Promise<ApiResponse<SimpleFlashcard>> {
async createFlashcard(data: CreateFlashcardRequest): Promise<ApiResponse<Flashcard>> {
try {
return await this.makeRequest<ApiResponse<Flashcard>>('/flashcards', {
method: 'POST',
@ -102,7 +102,7 @@ class FlashcardsService {
}
}
async getFlashcard(id: string): Promise<ApiResponse<SimpleFlashcard>> {
async getFlashcard(id: string): Promise<ApiResponse<Flashcard>> {
try {
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`);
} catch (error) {
@ -113,7 +113,7 @@ class FlashcardsService {
}
}
async updateFlashcard(id: string, data: CreateSimpleFlashcardRequest): Promise<ApiResponse<SimpleFlashcard>> {
async updateFlashcard(id: string, data: CreateFlashcardRequest): Promise<ApiResponse<Flashcard>> {
try {
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`, {
method: 'PUT',