👔 feat: add optimistic update for bookmark button
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 52s
All checks were successful
Integration Tests / integration-tests (pull_request) Successful in 52s
This commit is contained in:
21
features/home/actions/Hero/removeHeroBannerMediaFromSaved.ts
Normal file
21
features/home/actions/Hero/removeHeroBannerMediaFromSaved.ts
Normal file
@ -0,0 +1,21 @@
|
||||
"use server";
|
||||
|
||||
import { backendFetch } from "@/shared/helpers/backendFetch";
|
||||
|
||||
export const removeHeroBannerMediaFromSaved = async (mediaId: string) => {
|
||||
try {
|
||||
return await backendFetch("collections/sys", {
|
||||
method: "DELETE",
|
||||
body: JSON.stringify({
|
||||
name: "Saved",
|
||||
itemId: mediaId,
|
||||
}),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error removing media from saved list:", error);
|
||||
return {
|
||||
success: false,
|
||||
message: "Failed to remove media from saved list.",
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user