22try {
23const token = localStorage.getItem('teacherToken') || '';
24const response = await fetch(`/api/quiz/${quiz.quiz_id}/submissions`, {
25headers: {
26'Authorization': `Bearer ${token}`
RoshanMustaqbilLoginForm.tsx1 match
17
18// For demo purposes, we're using a mock token
19// In a real app, you would authenticate with your API
20setTimeout(() => {
21// Mock successful login for teacher@example.com/password
RoshanMustaqbilindex.tsx1 match
28
29try {
30const response = await fetch('/api/dashboard', {
31headers: {
32'Authorization': `Bearer ${token}`
RoshanMustaqbilapi.ts6 matches
1// Mock API functions for teacher dashboard
2// In real implementation, these would connect to your actual backend API
34import { User, Quiz, QuizSubmission, QuizWithStats, SubmissionStats, DashboardData } from './types';
56// Mock data - replace with actual API calls
7const MOCK_TEACHER: User = {
8user_id: "t123",
162// Get teacher data with authentication token
163export async function getTeacherData(token: string): Promise<User | null> {
164// In real implementation, validate token with your API
165// For mock, just return the teacher
166return MOCK_TEACHER;
169// Get all quizzes for a teacher with stats
170export async function getTeacherQuizzes(teacherId: string): Promise<QuizWithStats[]> {
171// In real implementation, fetch from your API
172const teacherQuizzes = MOCK_QUIZZES.filter(q => q.teacher_id === teacherId);
173
180// Get submissions for a specific quiz
181export async function getQuizSubmissions(quizId: string): Promise<QuizSubmission[]> {
182// In real implementation, fetch from your API
183return MOCK_SUBMISSIONS.filter(s => s.quiz_id === quizId);
184}
RoshanMustaqbiltypes.ts2 matches
48}
4950// API Response types
51export interface ApiResponse<T> {
52success: boolean;
53data?: T;
RoshanMustaqbilREADME.md2 matches
9## Project Structure
1011- `backend/` - Server-side code aur API endpoints
12- `index.ts` - Main HTTP handler
13- `types.ts` - TypeScript types
14- `api.ts` - API functions
15- `frontend/` - Client-side code
16- `index.html` - Main HTML template
35- React for UI components and state management
36- TailwindCSS for styling
37- LocalStorage API for data persistence
3839## Usage
1# Project Gutenberg Metadata API
23This API provides a simple way to retrieve metadata about books from Project Gutenberg in JSON format.
45## API Endpoint
67The API has a single endpoint that accepts a book ID and returns metadata about that book.
89### Request
25### Response
2627The API returns a JSON object with the following fields (when available):
2829- `id`: The Project Gutenberg book ID
80## Notes
8182- This API scrapes data from Project Gutenberg's website and may break if their site structure changes
83- Results are cached for 24 hours to reduce load on Project Gutenberg's servers
84- Please be respectful of Project Gutenberg's resources and don't make excessive requests
Gutenberggutenberg-metadata.ts2 matches
1/**
2* Project Gutenberg Metadata API
3*
4* This API endpoint retrieves metadata about books from Project Gutenberg
5* and returns it in a structured JSON format.
6*