mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-14 15:20:45 -03:00
añadido editar y eliminar posts
This commit is contained in:
@@ -11,12 +11,18 @@ export const addPost = (post: Post) => {
|
||||
posts.update((currentPosts) => [post, ...currentPosts]);
|
||||
};
|
||||
|
||||
export const updatePost = (postId: string, updatedData: Partial<Post>) => {
|
||||
export const updatePostStore = (postId: string, updatedData: Partial<Post>) => {
|
||||
posts.update((currentPosts) =>
|
||||
currentPosts.map((post) => (post._id === postId ? { ...post, ...updatedData } : post))
|
||||
currentPosts.map((post) => (post.id === postId ? { ...post, ...updatedData } : post))
|
||||
);
|
||||
};
|
||||
|
||||
export const removePost = (postId: string) => {
|
||||
posts.update((currentPosts) => currentPosts.filter((post) => post._id !== postId));
|
||||
posts.update((currentPosts) => {
|
||||
const a = currentPosts.filter((post) => post.id !== postId);
|
||||
console.log(a);
|
||||
return a;
|
||||
});
|
||||
|
||||
console.log(postId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user