From c7f230da675998003e3819cc519f72aee7d761bc Mon Sep 17 00:00:00 2001 From: amir-kedis Date: Tue, 26 Dec 2023 15:52:46 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fix=20info=20sections=20r?= =?UTF-8?q?equest=20to=20match=20new=20api=20conventions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/common/InfoSection.jsx | 18 +++++++++--------- client/src/redux/slices/captainsApiSlice.js | 3 +-- client/src/redux/slices/financeApiSlice.js | 2 +- client/src/redux/slices/scoutApiSlice.js | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/client/src/components/common/InfoSection.jsx b/client/src/components/common/InfoSection.jsx index 35e91006..add8ae5b 100644 --- a/client/src/components/common/InfoSection.jsx +++ b/client/src/components/common/InfoSection.jsx @@ -17,7 +17,7 @@ export default function InfoSection() { const { data: absenceRate, isFetching: isFetchingAbsence } = useGetAbsenceRateQuery(); - const { data: scoutsCount, isFetching: isFetchingScoutsCount } = + const { data: scouts, isFetching: isFetchingScoutsCount } = useGetAllScoutsCountQuery(); const { data: budget, isFetching: isFetchingBudget } = useGetBudgetQuery(); @@ -51,9 +51,9 @@ export default function InfoSection() { value={ isFetchingScoutsCount ? "جاري التحميل" - : !scoutsCount + : !scouts ? "لا يوجد بيانات" - : scoutsCount?.body + : scouts?.body?.length } color="dark" /> @@ -77,7 +77,7 @@ export default function InfoSection() { const { data: absenceRate, isFetching: isFetchingAbsence } = useGetAbsenceRateQuery(); - const { data: scoutsCount, isFetching: isFetchingScoutsCount } = + const { data: scouts, isFetching: isFetchingScoutsCount } = useGetAllScoutsCountQuery(); return ( @@ -98,9 +98,9 @@ export default function InfoSection() { value={ isFetchingScoutsCount ? "جاري التحميل" - : !scoutsCount + : !scouts ? "لا يوجد بيانات" - : scoutsCount?.body + : scouts?.body?.length } color="dark" /> @@ -116,7 +116,7 @@ export default function InfoSection() { const { data: absenceRate, isFetching: isFetchingAbsence } = useGetAbsenceRateQuery(); - const { data: scoutsCount, isFetching: isFetchingScoutsCount } = + const { data: scouts, isFetching: isFetchingScoutsCount } = useGetAllScoutsCountQuery(); return ( @@ -149,9 +149,9 @@ export default function InfoSection() { value={ isFetchingScoutsCount ? "جاري التحميل" - : !scoutsCount + : !scouts ? "لا يوجد بيانات" - : scoutsCount?.body + : scouts?.body?.length } color="dark" /> diff --git a/client/src/redux/slices/captainsApiSlice.js b/client/src/redux/slices/captainsApiSlice.js index f3e23950..055a75a2 100644 --- a/client/src/redux/slices/captainsApiSlice.js +++ b/client/src/redux/slices/captainsApiSlice.js @@ -6,11 +6,10 @@ export const captainsApi = apiSlice.injectEndpoints({ endpoints: (builder) => ({ GetCaptains: builder.query({ query: () => ({ - url: `${CAPTAINS_URL}/allCaptains/info`, + url: `${CAPTAINS_URL}/`, method: "GET", }), }), - }), }); diff --git a/client/src/redux/slices/financeApiSlice.js b/client/src/redux/slices/financeApiSlice.js index c429ba25..c09ec1b4 100644 --- a/client/src/redux/slices/financeApiSlice.js +++ b/client/src/redux/slices/financeApiSlice.js @@ -6,7 +6,7 @@ export const financeApi = apiSlice.injectEndpoints({ endpoints: (builder) => ({ GetBudget: builder.query({ query: () => ({ - url: `${FINANCE_URL}/budget`, + url: `${FINANCE_URL}`, method: "GET", }), }), diff --git a/client/src/redux/slices/scoutApiSlice.js b/client/src/redux/slices/scoutApiSlice.js index 40b3b980..5327df4d 100644 --- a/client/src/redux/slices/scoutApiSlice.js +++ b/client/src/redux/slices/scoutApiSlice.js @@ -6,7 +6,7 @@ export const scoutsApi = apiSlice.injectEndpoints({ endpoints: (builder) => ({ GetAllScoutsCount: builder.query({ query: () => ({ - url: `${SCOUT_URL}/allScouts/count`, + url: `${SCOUT_URL}/`, method: "GET", }), }),