* Adds a new item to user favorites * @param {string} workspaceSlug - The unique slug identifier for the workspace * @param {Partial } data - Favorite item data to be added * @returns {Promise } Promise resolving to the created favorite item * @throws {Error} If the A
(workspaceSlug: string, data: Partial<IFavorite>)
| 26 | * @throws {Error} If the API request fails |
| 27 | */ |
| 28 | async add(workspaceSlug: string, data: Partial<IFavorite>): Promise<IFavorite> { |
| 29 | return this.post(`/api/workspaces/${workspaceSlug}/user-favorites/`, data) |
| 30 | .then((response) => response?.data) |
| 31 | .catch((error) => { |
| 32 | throw error?.response; |
| 33 | }); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Updates an existing favorite item |
no test coverage detected