50 try {
51 // Exchange the credential for access tokens
52 const authResponse = await fetch('/api/auth/google', {
53 method: 'POST',
54 headers: {
44 setIsLoading(true);
45 try {
46 const response = await fetch("/api/catalog/format", {
47 method: "POST",
48 headers: { "Content-Type": "application/json" },
74 setIsLoading(true);
75 try {
76 const response = await fetch("/api/catalog/auto-replies", {
77 method: "POST",
78 headers: { "Content-Type": "application/json" },
102
103 try {
104 const response = await fetch("/api/catalog/export", {
105 method: "POST",
106 headers: { "Content-Type": "application/json" },
159
160// This is the entry point for HTTP vals
161export default app.fetch;
123});
124
125export default app.fetch;
22 };
23
24 const response = await fetch('/api/generate-names', {
25 method: 'POST',
26 headers: {
60 }
61 // For non-API routes, serve the main app (SPA routing)
62 return staticRoutes.fetch(new Request(c.req.url.replace(path, "/")));
63});
64
65// This is the entry point for HTTP vals
66export default app.fetch;
35 const refreshAccessToken = async (refreshToken: string) => {
36 try {
37 const response = await fetch('/api/auth/refresh', {
38 method: 'POST',
39 headers: {
68 };
69
70 const response = await fetch('/api/plans/generate', {
71 method: 'POST',
72 headers: {
15 url.searchParams.set('maxResults', '250');
16
17 const response = await fetch(url.toString(), {
18 headers: {
19 'Authorization': `Bearer ${accessToken}`,
23
24 if (!response.ok) {
25 throw new Error(`Failed to fetch events: ${response.statusText}`);
26 }
27
33 const googleEvent = this.transformToGoogleEvent(eventData);
34
35 const response = await fetch(`${this.baseUrl}/calendars/primary/events`, {
36 method: 'POST',
37 headers: {
26
27 // Load recent meal plans
28 const plansResponse = await fetch(`/api/plans/user/${user.id}`);
29 if (plansResponse.ok) {
30 const plansData = await plansResponse.json();
46
47 try {
48 const response = await fetch(`/api/plans/${planId}?userId=${user.id}`, {
49 method: 'DELETE'
50 });