mirror of
https://github.com/docmost/docmost.git
synced 2026-05-21 09:14:07 +08:00
feat: favorites (#2103)
* feat: favorites and templates(ee) * rename migrations * fix sidebar * cleanup tabs * fix * turn off templates * cleanup * uuid validation
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import api from "@/lib/api-client";
|
||||
import { IPagination } from "@/lib/types.ts";
|
||||
import { IFavorite, FavoriteType } from "../types/favorite.types";
|
||||
|
||||
export type ToggleFavoriteParams = {
|
||||
type: FavoriteType;
|
||||
pageId?: string;
|
||||
spaceId?: string;
|
||||
templateId?: string;
|
||||
};
|
||||
|
||||
export async function addFavorite(
|
||||
params: ToggleFavoriteParams,
|
||||
): Promise<void> {
|
||||
await api.post("/favorites/add", params);
|
||||
}
|
||||
|
||||
export async function removeFavorite(
|
||||
params: ToggleFavoriteParams,
|
||||
): Promise<void> {
|
||||
await api.post("/favorites/remove", params);
|
||||
}
|
||||
|
||||
export async function getFavorites(params?: {
|
||||
type?: FavoriteType;
|
||||
limit?: number;
|
||||
cursor?: string;
|
||||
}): Promise<IPagination<IFavorite>> {
|
||||
const req = await api.post("/favorites", params);
|
||||
return req.data;
|
||||
}
|
||||
Reference in New Issue
Block a user