CognxSafeTrack
Claude Sonnet 4.6
feat: backlog P0→P3 — toast system, payments, tenant isolation, feedback handler, i18n parity
6dd9bad Download apps/web/src/hooks/useStudentData.ts from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 729 Bytes
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/web/src/hooks/useStudentData.ts
- Command line
-
hf download hf://spaces/safetrack/edtech/apps/web/src/hooks/useStudentData.ts
-
curl -L -o useStudentData.ts https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/web/src/hooks/useStudentData.ts
729 Bytes
| import { useState, useEffect } from 'react'; | |
| import { apiClient } from '../lib/api'; | |
| export function useStudentData(phone: string | undefined) { | |
| const [data, setData] = useState<any>(null); | |
| const [loading, setLoading] = useState(true); | |
| const [error, setError] = useState<string | null>(null); | |
| useEffect(() => { | |
| if (!phone) { | |
| setLoading(false); | |
| return; | |
| } | |
| setLoading(true); | |
| apiClient.getStudent(phone) | |
| .then(setData) | |
| .catch(err => { | |
| setError(err.message || 'Impossible de charger tes données.'); | |
| }) | |
| .finally(() => setLoading(false)); | |
| }, [phone]); | |
| return { data, loading, error }; | |
| } | |