feat(epic-3): implémentation du Dashboard, mode lecture et notifications temps réel

This commit is contained in:
Michael committed 2026-02-04 15:12:54 +01:00
1 parent 1d31de95ec
commit dc26f22f51
20 files changed
+1237 -107

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
import { API_BASE, handleResponse } from './client';
export interface Feed {
id: string;
user_id: string;
url: string;
title: string;
description?: string;
site_url?: string;
image_url?: string;
last_fetched_at?: string;
fetch_error?: string;
created_at: string;
updated_at: string;
unread_count?: number;
}
export interface AddFeedRequest {
url: string;
}
export const feedsApi = {
async list(): Promise<Feed[]> {
const response = await fetch(`${API_BASE}/feeds`, {
credentials: 'include',
});
return handleResponse<Feed[]>(response);
},
async add(data: AddFeedRequest): Promise<Feed> {
const response = await fetch(`${API_BASE}/feeds`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify(data),
});
return handleResponse<Feed>(response);
},
async get(id: string): Promise<Feed> {
const response = await fetch(`${API_BASE}/feeds/${id}`, {
credentials: 'include',
});
return handleResponse<Feed>(response);
},
async delete(id: string): Promise<void> {
const response = await fetch(`${API_BASE}/feeds/${id}`, {
method: 'DELETE',
credentials: 'include',
});
await handleResponse(response);
},
async importOPML(file: File): Promise<{ imported: number; skipped: number; errors?: string[] }> {
const formData = new FormData();
formData.append('file', file);
const response = await fetch(`${API_BASE}/feeds/import/opml`, {
method: 'POST',
credentials: 'include',
body: formData,
});
return handleResponse(response);
},
};