Добавил случаев в extrareducers
This commit is contained in:
1 parent
a9b5d57fc9
commit
86f53ba61f
1 file changed
+15
-3
@@ -67,15 +67,27 @@ const catalogSlice = createSlice({
|
|||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.products = action.payload;
|
state.products = action.payload;
|
||||||
state.filtered = 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) => {
|
.addCase(fetchCategoryParameters.fulfilled, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.filters = action.payload
|
state.filters = action.payload
|
||||||
})
|
})
|
||||||
/*.addCase(getCategoryProducts.rejected, (state, action) => {
|
.addCase(fetchCategoryParameters.rejected, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.error = action.error.message || "Ошибка загрузки данных";
|
state.error = action.error.message || "Ошибка загрузки параметров категории";
|
||||||
});*/
|
state.filters = {};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user