Добавил случаев в extrareducers

This commit is contained in:
Joe_Peach committed 2025-11-22 21:46:41 +03:00
1 parent a9b5d57fc9
commit 86f53ba61f
1 file changed
+15 -3
+15 -3
View File
@@ -67,15 +67,27 @@ const catalogSlice = createSlice({
state.loading = false;
state.products = action.payload;
state.filtered = action.payload;
state.error = null;
})
.addCase(fetchProductsByCategory.rejected, (state, action) => {
state.loading = false;
state.error = action.error.message || "Ошибка загрузки товаров";
state.products = [];
state.filtered = [];
})
.addCase(fetchCategoryParameters.pending, (state) => {
state.loading = true;
state.error = null;
})
.addCase(fetchCategoryParameters.fulfilled, (state, action) => {
state.loading = false;
state.filters = action.payload
})
/*.addCase(getCategoryProducts.rejected, (state, action) => {
.addCase(fetchCategoryParameters.rejected, (state, action) => {
state.loading = false;
state.error = action.error.message || "Ошибка загрузки данных";
});*/
state.error = action.error.message || "Ошибка загрузки параметров категории";
state.filters = {};
});
},
});