Download frontend/src/hooks/useStudentData.js from Seth0330/keeai: direct link, hf CLI and curl.
- Browser
- Download file 891 Bytes
-
https://huggingface.co/spaces/Seth0330/keeai/resolve/main/frontend/src/hooks/useStudentData.js
- Command line
-
hf download hf://spaces/Seth0330/keeai/frontend/src/hooks/useStudentData.js
-
curl -L -o useStudentData.js https://huggingface.co/spaces/Seth0330/keeai/resolve/main/frontend/src/hooks/useStudentData.js
891 Bytes
| import { useQuery } from "@tanstack/react-query"; | |
| import api from "../api/client"; | |
| // Helper: read email from localStorage (set at login) | |
| function getStudentEmail() { | |
| return localStorage.getItem("studentEmail") || ""; | |
| } | |
| export function useStudentMemberships() { | |
| const email = getStudentEmail(); | |
| return useQuery({ | |
| queryKey: ["student-memberships", email], | |
| enabled: !!email, | |
| queryFn: async () => { | |
| const res = await api.get("/student/memberships", { | |
| params: { email }, | |
| }); | |
| return res.data; | |
| }, | |
| }); | |
| } | |
| export function useStudentUpcomingRenewal() { | |
| const email = getStudentEmail(); | |
| return useQuery({ | |
| queryKey: ["student-upcoming-renewal", email], | |
| enabled: !!email, | |
| queryFn: async () => { | |
| const res = await api.get("/student/upcoming-renewal", { | |
| params: { email }, | |
| }); | |
| return res.data; | |
| }, | |
| }); | |
| } | |