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:
parent
9c3178d104
commit
af45b5d3da
|
|
@ -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 {
|
try {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
if (search) params.append('search', search);
|
if (search) params.append('search', search);
|
||||||
|
|
@ -66,7 +66,7 @@ class FlashcardsService {
|
||||||
const queryString = params.toString();
|
const queryString = params.toString();
|
||||||
const endpoint = `/flashcards${queryString ? `?${queryString}` : ''}`;
|
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) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
|
@ -75,7 +75,7 @@ class FlashcardsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async createFlashcard(data: CreateSimpleFlashcardRequest): Promise<ApiResponse<SimpleFlashcard>> {
|
async createFlashcard(data: CreateFlashcardRequest): Promise<ApiResponse<Flashcard>> {
|
||||||
try {
|
try {
|
||||||
return await this.makeRequest<ApiResponse<Flashcard>>('/flashcards', {
|
return await this.makeRequest<ApiResponse<Flashcard>>('/flashcards', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -102,7 +102,7 @@ class FlashcardsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFlashcard(id: string): Promise<ApiResponse<SimpleFlashcard>> {
|
async getFlashcard(id: string): Promise<ApiResponse<Flashcard>> {
|
||||||
try {
|
try {
|
||||||
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`);
|
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`);
|
||||||
} catch (error) {
|
} 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 {
|
try {
|
||||||
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`, {
|
return await this.makeRequest<ApiResponse<Flashcard>>(`/flashcards/${id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue