Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 4x 44x 43x 43x 43x 22x 22x 22x 21x 1x 20x 20x 2x 22x 22x 43x | import { useEffect, useState } from "react";
export interface SignupInfo {
userCount: string;
// ISO8601 datetime
lastSignup: string;
lastLocation: string;
}
export default function useSignupPageInfo() {
const [signupInfo, setSignupInfo] = useState<SignupInfo | null>(null);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
const fetchSignupInfo = async () => {
try {
const response = await fetch("https://couchers.org/api/public/signup-page-info");
if (!response.ok) {
throw new Error("Failed to fetch signup info");
}
const data = await response.json();
setSignupInfo(data);
} catch (error) {
console.error("Error fetching signup info:", error);
} finally {
setIsLoading(false);
}
};
fetchSignupInfo();
}, []);
return { signupInfo, isLoading };
}
|