task(F2-frontend): library search, favorites section, star toggle, svg thumbnails, grid view
This commit is contained in:
@@ -660,6 +660,7 @@ export interface GlobalBlock {
|
||||
name: string;
|
||||
block_data: string;
|
||||
svg_data: string | null;
|
||||
is_favorite: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
@@ -698,6 +699,17 @@ export async function renameGlobalBlock(token: string, id: string, name: string)
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// Task F2: Favorite-Toggle für globale Blöcke
|
||||
export async function setGlobalBlockFavorite(token: string, id: string, isFavorite: boolean): Promise<GlobalBlock> {
|
||||
const res = await fetch(`${API_BASE}/api/global-blocks/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: authHeaders(token),
|
||||
body: JSON.stringify({ is_favorite: isFavorite }),
|
||||
});
|
||||
if (!res.ok) throw new Error('Failed to set favorite');
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function deleteGlobalBlock(token: string, id: string): Promise<void> {
|
||||
const res = await fetch(`${API_BASE}/api/global-blocks/${id}`, {
|
||||
method: 'DELETE',
|
||||
|
||||
Reference in New Issue
Block a user