From 6d12fc0095fce30a35ab9172717955597dc37c03 Mon Sep 17 00:00:00 2001 From: SilverD3 Date: Thu, 3 Oct 2024 15:13:43 +0100 Subject: [PATCH] fix:OH2-401 | Fix admission state slice --- src/state/admissions/slice.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/state/admissions/slice.ts b/src/state/admissions/slice.ts index 1a371f993..20fb21690 100644 --- a/src/state/admissions/slice.ts +++ b/src/state/admissions/slice.ts @@ -58,7 +58,7 @@ export const admissionSlice = createSlice({ state.getAdmissions = ApiResponse.loading(); }) .addCase(thunks.getAdmissions.fulfilled, (state, action) => { - state.getAdmissions.status = isEmpty(action.payload.data) + state.getAdmissions.status = isEmpty(action.payload?.data) ? "SUCCESS_EMPTY" : "SUCCESS"; state.getAdmissions.data = action.payload; @@ -71,7 +71,7 @@ export const admissionSlice = createSlice({ state.getDischarges = ApiResponse.loading(); }) .addCase(thunks.getDischarges.fulfilled, (state, action) => { - state.getDischarges.status = isEmpty(action.payload.data) + state.getDischarges.status = isEmpty(action.payload?.data) ? "SUCCESS_EMPTY" : "SUCCESS"; state.getDischarges.data = action.payload;