Allow adding an account to a collection directly from the profile page (#39080)
This commit is contained in:
1 parent
a444a0b572
commit
6e7e8de343
11 files changed
+354
-66
No files matched your search
@@ -283,8 +283,12 @@ const collectionSlice = createSlice({
|
||||
builder.addCase(addCollectionItem.fulfilled, (state, action) => {
|
||||
const { collection_item } = action.payload;
|
||||
const { collectionId } = action.meta.arg;
|
||||
const collection = state.collections[collectionId];
|
||||
|
||||
state.collections[collectionId]?.items.push(collection_item);
|
||||
if (collection) {
|
||||
collection.items.push(collection_item);
|
||||
collection.item_count++;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -302,6 +306,7 @@ const collectionSlice = createSlice({
|
||||
collection.items = collection.items.filter(
|
||||
(item) => item.id !== itemId,
|
||||
);
|
||||
collection.item_count--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user