From 86f53ba61fef8d2015cdc3126c501282a6c6c886 Mon Sep 17 00:00:00 2001 From: Oleg Urin Date: Sat, 22 Nov 2025 21:46:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B5=D0=B2=20=D0=B2=20extraredu?= =?UTF-8?q?cers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/features/catalog/catalogSlice.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/front/src/features/catalog/catalogSlice.ts b/front/src/features/catalog/catalogSlice.ts index bfa06a0..06dbda4 100644 --- a/front/src/features/catalog/catalogSlice.ts +++ b/front/src/features/catalog/catalogSlice.ts @@ -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 = {}; + }); }, });