58 return c.json(stats);
59 } catch (error) {
60 console.error("Error fetching subscriber stats:", error);
61 return c.json({ error: "Failed to fetch stats" }, 500);
62 }
63});
12 return c.json(releases);
13 } catch (error) {
14 console.error("Error fetching releases:", error);
15 return c.json({ error: "Failed to fetch releases" }, 500);
16 }
17});
35 };
36
37 const response = await fetch('/api/votes', {
38 method: 'POST',
39 headers: {
80 };
81
82 const response = await fetch(endpoint, {
83 method: 'POST',
84 headers: {
30 const checkAuth = async () => {
31 try {
32 const response = await fetch('/api/auth/me');
33 const data: ApiResponse<User> = await response.json();
34
49 const loadPolls = async () => {
50 try {
51 const response = await fetch('/api/polls');
52 const data: ApiResponse<Poll[]> = await response.json();
53
71 const handleLogout = async () => {
72 try {
73 await fetch('/api/auth/logout', { method: 'POST' });
74 setUser(null);
75 setPolls([]);
112 const loadPollDetails = async (pollId: number) => {
113 try {
114 const response = await fetch(`/api/polls/${pollId}`);
115 const data: ApiResponse<Poll> = await response.json();
116
52app.get("/health", c => c.json({ status: "ok" }));
53
54// Export the fetch handler for Val Town
55export default app.fetch;
83 };
84
85 const response = await fetch('/api/chat/messages', {
86 method: 'POST',
87 headers: {
33 };
34
35 const response = await fetch('/api/jobs', {
36 method: 'POST',
37 headers: {
42
43// This is the entry point for HTTP vals
44export default app.fetch;
44
45// This is the entry point for HTTP vals
46export default app.fetch;