| export interface SystemDesignTopic { |
| id: string; |
| chapter_no: number; |
| chapter_name: string; |
| subtitle: string; |
| level: string; |
| } |
|
|
| export interface SystemDesignTopicContent extends SystemDesignTopic { |
| content: any; |
| } |
|
|
| export async function fetchSystemDesignTopics(): Promise<SystemDesignTopic[]> { |
| const res = await fetch('/api/system-design/topics'); |
| if (!res.ok) throw new Error('Failed to fetch topics'); |
| const data = await res.json(); |
| return data.topics || []; |
| } |
|
|
| export async function fetchSystemDesignTopicContent(chapterNo: number): Promise<SystemDesignTopicContent> { |
| const res = await fetch(`/api/system-design/topics/${chapterNo}`); |
| if (!res.ok) throw new Error('Failed to fetch topic content'); |
| return res.json(); |
| } |
|
|