feat: process now button

This commit is contained in:
Leon
2025-07-16 18:20:21 +02:00
parent ad0d71cd2e
commit 0e19af170d
10 changed files with 238 additions and 28 deletions

View File

@@ -1,26 +1,27 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import type { Metadata } from "next"
import { Geist, Geist_Mono } from "next/font/google"
import "./globals.css"
import { Toaster } from "@/components/ui/sonner"
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
})
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
})
export const metadata: Metadata = {
title: "LetterFeed",
description: "Read your newsletters as RSS feeds!",
};
}
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
children: React.ReactNode
}>) {
return (
<html lang="en">
@@ -28,7 +29,8 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
<Toaster />
</body>
</html>
);
)
}

View File

@@ -137,6 +137,18 @@ export async function testImapConnection(): Promise<{ message: string }> {
return response.json();
}
export async function processEmails(): Promise<{ message: string }> {
const response = await fetch(`${API_BASE_URL}/imap/process`, {
method: 'POST',
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.detail || "Failed to process emails");
}
return response.json();
}
export function getFeedUrl(newsletterId: number): string {
return `${API_BASE_URL}/feeds/${newsletterId}`;
}