From aefcef6e061c7227ba80030f0bf3259493a97d13 Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Fri, 22 Sep 2023 17:40:52 +0530 Subject: [PATCH 01/10] GOK-364 | Add. Load Stock button in inventory landing page | [Sweety/Riya] --- src/components/LoadStock/index.jsx | 285 ++++++++++++++++++ .../LoadStock/loadStock.module.scss | 18 ++ src/inventory/inventory-landing-page.jsx | 18 +- src/inventory/inventory-menu.jsx | 2 +- src/inventory/inventory.module.scss | 6 + 5 files changed, 321 insertions(+), 8 deletions(-) create mode 100644 src/components/LoadStock/index.jsx create mode 100644 src/components/LoadStock/loadStock.module.scss diff --git a/src/components/LoadStock/index.jsx b/src/components/LoadStock/index.jsx new file mode 100644 index 0000000..6fee7a5 --- /dev/null +++ b/src/components/LoadStock/index.jsx @@ -0,0 +1,285 @@ +import { Add16, Subtract16 } from "@carbon/icons-react"; +import { + Button, + Column, + ComboBox, + DataTable, + DatePicker, + DatePickerInput, + Modal, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableHeader, + TableRow, + TextInput, +} from "carbon-components-react"; +import React, { useEffect, useState } from "react"; +import { useCookies } from "react-cookie"; +import useSWR from "swr"; +import { failureMessage, locationCookieName, successMessage } from "../../../constants"; +import "../../../index.scss"; +import { getLoadStockObj } from "../../inventory/stock-receipt/eaushadha-response-mapper"; +import saveStockInitial from "../../service/save-initial"; +import { fetcher, invItemURL, inventoryItemURL, stockRoomURL } from "../../utils/api-utils"; +import { getDatePattern } from "../../utils/date-utils"; +import { ResponseNotification } from "../notifications/response-notification"; +import styles from "./loadStock.module.scss"; + +export const LoadStock = (props) => { + const [addDrugItems, setAddDrugItems] = useState([]); + const [showModal, setShowModal] = useState(false); + const [isSaveButtonDisabled, setSaveButtonDisabled] = useState(true); + const [rows, setRows] = useState([{ id: 1, drugName: "", batchNo: "", expiryDate: "", quantity: 0, totalQuantity: 0 }]); + const [onSuccessful, setOnSuccessful] = useState(false); + const [onFailure, setOnFailure] = useState(false); + const [cookies] = useCookies(); + const { setReloadData } = props; + let totalInventoryItems = inventoryItems?.length; + let dropdownItems = []; + + const { data: inventoryItems, error: inventoryItemsError } = useSWR(inventoryItemURL(), fetcher); + const { data: stockRoom, error: stockRoomError } = useSWR(stockRoomURL(cookies[locationCookieName]?.name.trim()), fetcher); + const { data: invItems, error: inventoryItemError } = useSWR(totalInventoryItems !== undefined ? invItemURL(totalInventoryItems) : "", fetcher); + + if (invItems?.results?.length > 0) { + for (let index = 0; index < invItems.results.length; index++) { + dropdownItems.push(invItems.results[index].name); + } + } + + useEffect(() => { + if (onSuccessful) { + setAddDrugItems([]); + setReloadData(false); + } + }, [onSuccessful]); + + useEffect(() => { + if (!showModal) { + setAddDrugItems([]); + setRows([ + { + id: 1, + drugName: "", + batchNo: "", + expiryDate: "", + quantity: 0, + totalQuantity: 0, + invalid: false, + }, + ]); + } + }, [showModal]); + + useEffect(() => { + const hasEmptyOrNegativeFields = rows.some((row) => !row.drugName || !row.batchNo || !row.expiryDate || !row.totalQuantity || row.totalQuantity <= 0); + setSaveButtonDisabled(hasEmptyOrNegativeFields); + }, [rows]); + + useEffect(() => { + const saveData = async () => { + console.log("save data useEffect"); + try { + console.log("addDrugItems", addDrugItems); + console.log("stockRoom", stockRoom.results[0]?.uuid); + const response = await saveStockInitial(addDrugItems, "", stockRoom.results[0]?.uuid); + console.log("response", response); + if (response && response.ok) { + console.log("responseeee", response.ok); + setReloadData(true); + setOnSuccessful(true); + } else { + setOnFailure(true); + } + } catch (error) { + console.error("An error occurred during save:", error); + } + }; + + if (addDrugItems.length > 0) { + saveData(); + } + }, [addDrugItems]); + + const setOnSuccessAndFailure = (status) => { + setOnSuccessful(status); + setOnFailure(status); + }; + + const handleSaveDrugButtonClick = async () => { + try { + console.log("handleSaveDrugButtonClick", getLoadStockObj(rows)); + await setAddDrugItems(getLoadStockObj(rows)); + setShowModal(false); + } catch (error) { + console.error("An error occurred:", error); + return; + } + }; + + const handleAddRow = () => { + setRows((prevRows) => [ + ...prevRows, + { + id: prevRows.length + 1, + drugName: "", + batchNo: "", + expiryDate: "", + totalQuantity: 0, + invalid: false, + }, + ]); + }; + + const handleDeleteRow = (id) => { + setRows((prevRows) => prevRows.filter((row) => row.id !== id)); + }; + + const handleComboBoxChange = (rowId, selectedValue) => { + setRows((prevRows) => + prevRows.map((row) => { + if (row.id === rowId) { + return { ...row, drugName: selectedValue }; + } + return row; + }) + ); + }; + + const isInvalid = (id) => { + const row = rows.find((row) => row.id === id); + return row ? row.invalid : false; + }; + + const handleInputChange = (id, field, value) => { + if (field === "totalQuantity") { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, totalQuantity: value, invalid: value <= 0 } : row))); + } else if (field === "expiryDate") { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, expiryDate: value } : row))); + } else { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, [field]: value } : row))); + } + }; + + const handleCloseModal = () => { + setShowModal(false); + }; + + const filterItems = (menu) => menu?.item?.toLowerCase().includes(menu?.inputValue?.toLowerCase()); + + return ( + + + {onSuccessful && ResponseNotification("success", "Success", successMessage, setOnSuccessAndFailure)} + {onFailure && ResponseNotification("error", "Error", failureMessage, setOnSuccessAndFailure)} + + + {showModal && ( + + ( + + + + + {headers.map((header, index) => ( + + {header} + + ))} + + + + {rows.map((row) => ( + <> + + {row.id} + + handleComboBoxChange(row.id, selectedItem)} + style={{ width: "270px" }} + /> + + + handleInputChange(row.id, "batchNo", e.target.value)} + /> + + + handleInputChange(row.id, "expiryDate", date[0])} + > + handleInputChange(row.id, "expiryDate", e.target.value)} pattern={getDatePattern} /> + + + + handleInputChange(row.id, "totalQuantity", e.target.valueAsNumber)} + /> + + +
+ - )} + + {rows.length > 0 && ( + + )} @@ -147,6 +150,7 @@ const InventoryLandingPage = () => {
+ )}
diff --git a/src/inventory/inventory-menu.jsx b/src/inventory/inventory-menu.jsx index 20e05f2..9c02ee5 100644 --- a/src/inventory/inventory-menu.jsx +++ b/src/inventory/inventory-menu.jsx @@ -73,7 +73,7 @@ const InventoryMenu = () => {

{getLocationName(cookies[locationCookieName]?.name)}

- + diff --git a/src/inventory/inventory.module.scss b/src/inventory/inventory.module.scss index ad75d00..094e8cf 100644 --- a/src/inventory/inventory.module.scss +++ b/src/inventory/inventory.module.scss @@ -28,3 +28,9 @@ width: 50%; } } + +.inventoryContentContainer{ + display: flex; + flex-direction: column; + align-items: flex-end; +} \ No newline at end of file From 8bbff55c285160a41c8d97964352489897024707 Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Mon, 25 Sep 2023 12:13:33 +0530 Subject: [PATCH 02/10] GOK-364 | Fix. Load stock dropdown to show list of drug items | [Sweety/Riya] --- src/components/LoadStock/loadStock.jsx | 285 +++++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 src/components/LoadStock/loadStock.jsx diff --git a/src/components/LoadStock/loadStock.jsx b/src/components/LoadStock/loadStock.jsx new file mode 100644 index 0000000..202424a --- /dev/null +++ b/src/components/LoadStock/loadStock.jsx @@ -0,0 +1,285 @@ +import { Add16, Subtract16 } from "@carbon/icons-react"; +import { + Button, + Column, + ComboBox, + DataTable, + DatePicker, + DatePickerInput, + Modal, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableHeader, + TableRow, + TextInput, +} from "carbon-components-react"; +import React, { useEffect, useState } from "react"; +import { useCookies } from "react-cookie"; +import useSWR from "swr"; +import { failureMessage, locationCookieName, successMessage } from "../../../constants"; +import "../../../index.scss"; +import { getLoadStockObj } from "../../inventory/stock-receipt/eaushadha-response-mapper"; +import saveStockInitial from "../../service/save-initial"; +import { fetcher, invItemURL, inventoryItemURL, stockRoomURL } from "../../utils/api-utils"; +import { getDatePattern } from "../../utils/date-utils"; +import { ResponseNotification } from "../notifications/response-notification"; +import styles from "./loadStock.module.scss"; + +export const LoadStock = (props) => { + const [addDrugItems, setAddDrugItems] = useState([]); + const [showModal, setShowModal] = useState(false); + const [isSaveButtonDisabled, setSaveButtonDisabled] = useState(true); + const [rows, setRows] = useState([{ id: 1, drugName: "", batchNo: "", expiryDate: "", quantity: 0, totalQuantity: 0 }]); + const [onSuccessful, setOnSuccessful] = useState(false); + const [onFailure, setOnFailure] = useState(false); + const [cookies] = useCookies(); + const { setReloadData } = props; + let dropdownItems = []; + + const { data: inventoryItems, error: inventoryItemsError } = useSWR(inventoryItemURL(), fetcher); + let totalInventoryItems = inventoryItems?.length; + const { data: stockRoom, error: stockRoomError } = useSWR(stockRoomURL(cookies[locationCookieName]?.name.trim()), fetcher); + const { data: invItems, error: inventoryItemError } = useSWR(totalInventoryItems !== undefined ? invItemURL(totalInventoryItems) : "", fetcher); + + if (invItems?.results?.length > 0) { + for (let index = 0; index < invItems.results.length; index++) { + dropdownItems.push(invItems.results[index].name); + } + } + + useEffect(() => { + if (onSuccessful) { + setAddDrugItems([]); + setReloadData(false); + } + }, [onSuccessful]); + + useEffect(() => { + if (!showModal) { + setAddDrugItems([]); + setRows([ + { + id: 1, + drugName: "", + batchNo: "", + expiryDate: "", + quantity: 0, + totalQuantity: 0, + invalid: false, + }, + ]); + } + }, [showModal]); + + useEffect(() => { + const hasEmptyOrNegativeFields = rows.some((row) => !row.drugName || !row.batchNo || !row.expiryDate || !row.totalQuantity || row.totalQuantity <= 0); + setSaveButtonDisabled(hasEmptyOrNegativeFields); + }, [rows]); + + useEffect(() => { + const saveData = async () => { + console.log("save data useEffect"); + try { + console.log("addDrugItems", addDrugItems); + console.log("stockRoom", stockRoom.results[0]?.uuid); + const response = await saveStockInitial(addDrugItems, "", stockRoom.results[0]?.uuid); + console.log("response", response); + if (response && response.ok) { + console.log("responseeee", response.ok); + setReloadData(true); + setOnSuccessful(true); + } else { + setOnFailure(true); + } + } catch (error) { + console.error("An error occurred during save:", error); + } + }; + + if (addDrugItems.length > 0) { + saveData(); + } + }, [addDrugItems]); + + const setOnSuccessAndFailure = (status) => { + setOnSuccessful(status); + setOnFailure(status); + }; + + const handleSaveDrugButtonClick = async () => { + try { + console.log("handleSaveDrugButtonClick", getLoadStockObj(rows)); + await setAddDrugItems(getLoadStockObj(rows)); + setShowModal(false); + } catch (error) { + console.error("An error occurred:", error); + return; + } + }; + + const handleAddRow = () => { + setRows((prevRows) => [ + ...prevRows, + { + id: prevRows.length + 1, + drugName: "", + batchNo: "", + expiryDate: "", + totalQuantity: 0, + invalid: false, + }, + ]); + }; + + const handleDeleteRow = (id) => { + setRows((prevRows) => prevRows.filter((row) => row.id !== id)); + }; + + const handleComboBoxChange = (rowId, selectedValue) => { + setRows((prevRows) => + prevRows.map((row) => { + if (row.id === rowId) { + return { ...row, drugName: selectedValue }; + } + return row; + }) + ); + }; + + const isInvalid = (id) => { + const row = rows.find((row) => row.id === id); + return row ? row.invalid : false; + }; + + const handleInputChange = (id, field, value) => { + if (field === "totalQuantity") { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, totalQuantity: value, invalid: value <= 0 } : row))); + } else if (field === "expiryDate") { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, expiryDate: value } : row))); + } else { + setRows((prevRows) => prevRows.map((row) => (row.id === id ? { ...row, [field]: value } : row))); + } + }; + + const handleCloseModal = () => { + setShowModal(false); + }; + + const filterItems = (menu) => menu?.item?.toLowerCase().includes(menu?.inputValue?.toLowerCase()); + + return ( + + + {onSuccessful && ResponseNotification("success", "Success", successMessage, setOnSuccessAndFailure)} + {onFailure && ResponseNotification("error", "Error", failureMessage, setOnSuccessAndFailure)} + + + {showModal && ( + + ( + + + + + {headers.map((header, index) => ( + + {header} + + ))} + + + + {rows.map((row) => ( + <> + + {row.id} + + handleComboBoxChange(row.id, selectedItem)} + style={{ width: "270px" }} + /> + + + handleInputChange(row.id, "batchNo", e.target.value)} + /> + + + handleInputChange(row.id, "expiryDate", date[0])} + > + handleInputChange(row.id, "expiryDate", e.target.value)} pattern={getDatePattern} /> + + + + handleInputChange(row.id, "totalQuantity", e.target.valueAsNumber)} + /> + + +
+ - {showModal && ( - - ( - - - - - {headers.map((header, index) => ( - - {header} - - ))} - - - - {rows.map((row) => ( - <> - - {row.id} - - handleComboBoxChange(row.id, selectedItem)} - style={{ width: "270px" }} - /> - - - handleInputChange(row.id, "batchNo", e.target.value)} - /> - - - handleInputChange(row.id, "expiryDate", date[0])} - > - handleInputChange(row.id, "expiryDate", e.target.value)} pattern={getDatePattern} /> - - - - handleInputChange(row.id, "totalQuantity", e.target.valueAsNumber)} - /> - - -
-
- - - {showModal && ( - - ( - - - - - {headers.map((header, index) => ( - - {header} - - ))} - - - - {rows.map((row) => ( - <> - - {row.id} - - - handleComboBoxChange(row.id, selectedItem) - } - style={{ width: '270px' }} - /> - - - - handleInputChange(row.id, 'batchNo', e.target.value) - } - /> - - - - handleInputChange(row.id, 'expiryDate', date[0]) - } - > - - handleInputChange(row.id, 'expiryDate', e.target.value) - } - pattern={getDatePattern} - /> - - - - - handleInputChange( - row.id, - 'totalQuantity', - e.target.valueAsNumber, - ) - } - /> - - -
- )} - - + +
{headers.map((header) => ( @@ -150,7 +152,6 @@ const InventoryLandingPage = (props) => {
- )}
@@ -164,7 +165,7 @@ const InventoryLandingPage = (props) => { title={`Stock Details for ${selectedProductName}`} /> )} - + ); }; diff --git a/src/inventory/inventory.module.scss b/src/inventory/inventory.module.scss index 094e8cf..869a0cc 100644 --- a/src/inventory/inventory.module.scss +++ b/src/inventory/inventory.module.scss @@ -17,20 +17,11 @@ left: 0; z-index: 2; } -.tableToolbarContent { - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; -} .inventoryContainer { @media all and (min-width: 768px) { width: 50%; } -} - -.inventoryContentContainer{ - display: flex; + display: flex; flex-direction: column; align-items: flex-end; } \ No newline at end of file From e15bf42c52b8112525adf753be19a9b8e82c5ed8 Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Mon, 25 Sep 2023 18:01:45 +0530 Subject: [PATCH 06/10] GOK-364 | Format. fetcher method | [Sweety/Riya] --- src/utils/api-utils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/api-utils.js b/src/utils/api-utils.js index 19b1d61..d05c7bc 100644 --- a/src/utils/api-utils.js +++ b/src/utils/api-utils.js @@ -4,13 +4,13 @@ export const inventoryItemURL=()=>`/openmrs/ws/rest/v2/inventory/item?limit=1&v= export const invItemURL=(limit)=>`/openmrs/ws/rest/v2/inventory/item?limit=${limit}&v=full`; export const activePatientWithDrugOrders = (locationUuid) => `/openmrs/ws/rest/v1/bahmnicore/sql?location_uuid=${locationUuid}&q=emrapi.sqlSearch.activePatientsWithDrugOrders&v=full`; - export const fetcher = async (url) => { - const response = await fetch(url); - if (!response.ok) { - throw new Error(`HTTP error! Status: ${response.status}`); - } - return await response.json(); - }; +export const fetcher = async (url) => { + const response = await fetch(url); + if (!response.ok) { + throw new Error(`HTTP error! Status: ${response.status}`); + } + return await response.json(); +}; const controller = new AbortController(); const timeout = 150000; From 581ede577dad421abcc4f328635f509360d4b175 Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Tue, 26 Sep 2023 13:19:34 +0530 Subject: [PATCH 07/10] GOK-364 | Refactor. CSS for Load Stock button | [Sweety/Riya] --- src/components/LoadStock/loadStock.module.scss | 2 ++ src/inventory/inventory-landing-page.jsx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/LoadStock/loadStock.module.scss b/src/components/LoadStock/loadStock.module.scss index a61f3d0..15b2db2 100644 --- a/src/components/LoadStock/loadStock.module.scss +++ b/src/components/LoadStock/loadStock.module.scss @@ -1,6 +1,8 @@ @import '~carbon-components/scss/globals/scss/styles.scss'; .primaryButton{ background-color: #007d79 !important; + width: 10.76rem; + height: 3rem; } .iconButton { diff --git a/src/inventory/inventory-landing-page.jsx b/src/inventory/inventory-landing-page.jsx index 1f8bc4a..a636b19 100644 --- a/src/inventory/inventory-landing-page.jsx +++ b/src/inventory/inventory-landing-page.jsx @@ -93,7 +93,7 @@ const InventoryLandingPage = (props) => { <> - + From 76d863bb8e718e59296c8f9add58a01d0be6b59f Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Tue, 26 Sep 2023 15:08:26 +0530 Subject: [PATCH 08/10] GOK-364 | Rename. Stock reciept to Aushada | [Sweety/Riya] --- src/components/LoadStock/loadStock.jsx | 2 +- .../stock-receipt.jsx => aushada/aushada.jsx} | 4 ++-- .../aushada.module.scss} | 0 .../{stock-receipt => aushada}/eaushadha-response-mapper.js | 0 src/inventory/inventory-menu.jsx | 6 +++--- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/inventory/{stock-receipt/stock-receipt.jsx => aushada/aushada.jsx} (99%) rename src/inventory/{stock-receipt/stock-receipt.module.scss => aushada/aushada.module.scss} (100%) rename src/inventory/{stock-receipt => aushada}/eaushadha-response-mapper.js (100%) diff --git a/src/components/LoadStock/loadStock.jsx b/src/components/LoadStock/loadStock.jsx index eb2f435..286c0ac 100644 --- a/src/components/LoadStock/loadStock.jsx +++ b/src/components/LoadStock/loadStock.jsx @@ -21,7 +21,7 @@ import { useCookies } from "react-cookie"; import useSWR from "swr"; import { failureMessage, locationCookieName, successMessage } from "../../../constants"; import "../../../index.scss"; -import { getLoadStockObj } from "../../inventory/stock-receipt/eaushadha-response-mapper"; +import { getLoadStockObj } from "../../inventory/aushada/eaushadha-response-mapper"; import saveStockInitial from "../../service/save-initial"; import { fetcher, invItemURL, inventoryItemURL, stockRoomURL } from "../../utils/api-utils"; import { getDatePattern } from "../../utils/date-utils"; diff --git a/src/inventory/stock-receipt/stock-receipt.jsx b/src/inventory/aushada/aushada.jsx similarity index 99% rename from src/inventory/stock-receipt/stock-receipt.jsx rename to src/inventory/aushada/aushada.jsx index 3a1f8e8..9074f34 100644 --- a/src/inventory/stock-receipt/stock-receipt.jsx +++ b/src/inventory/aushada/aushada.jsx @@ -39,7 +39,7 @@ import { } from './eaushadha-response-mapper'; import styles from './stock-receipt.module.scss'; -const StockReceipt = (props) => { +const Aushada = (props) => { const [items, setItems] = useState([]); const [outwardNumber, setOutwardNumber] = useState(''); const [stockIntakeButtonClick, setStockIntakeButtonClick] = useState(false); @@ -349,6 +349,6 @@ const StockReceipt = (props) => { ); }; -export default StockReceipt; +export default Aushada; diff --git a/src/inventory/stock-receipt/stock-receipt.module.scss b/src/inventory/aushada/aushada.module.scss similarity index 100% rename from src/inventory/stock-receipt/stock-receipt.module.scss rename to src/inventory/aushada/aushada.module.scss diff --git a/src/inventory/stock-receipt/eaushadha-response-mapper.js b/src/inventory/aushada/eaushadha-response-mapper.js similarity index 100% rename from src/inventory/stock-receipt/eaushadha-response-mapper.js rename to src/inventory/aushada/eaushadha-response-mapper.js diff --git a/src/inventory/inventory-menu.jsx b/src/inventory/inventory-menu.jsx index e2ba650..be46f00 100644 --- a/src/inventory/inventory-menu.jsx +++ b/src/inventory/inventory-menu.jsx @@ -5,7 +5,7 @@ import useSWR, { mutate } from 'swr'; import InventoryLandingPage from './inventory-landing-page'; import { getLocationName, inventoryMenu, locationCookieName } from '../../constants'; import DispensePage from './dispense/dispense-page'; -import StockReceipt from './stock-receipt/stock-receipt'; +import Aushada from './aushada/aushada'; import { fetcher, invItemURLByStockroom, stockRoomURL } from '../utils/api-utils'; import { useItemStockContext, useStockRoomContext } from '../context/item-stock-context'; import { ResponseNotification } from '../components/notifications/response-notification'; @@ -75,8 +75,8 @@ const InventoryMenu = () => { - - + + From 3befd941729633fd2fc20d047aaa97fdcc937020 Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Tue, 26 Sep 2023 15:20:54 +0530 Subject: [PATCH 09/10] GOK-364 | Fix. CSS import | [Sweety/Riya] --- src/inventory/aushada/aushada.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inventory/aushada/aushada.jsx b/src/inventory/aushada/aushada.jsx index 9074f34..5afbf57 100644 --- a/src/inventory/aushada/aushada.jsx +++ b/src/inventory/aushada/aushada.jsx @@ -37,7 +37,7 @@ import { getCalculatedQuantity, getStockReceiptObj, } from './eaushadha-response-mapper'; -import styles from './stock-receipt.module.scss'; +import styles from './aushada.module.scss'; const Aushada = (props) => { const [items, setItems] = useState([]); From c7bfdddada05fd51e329cc42ff124f05df63164f Mon Sep 17 00:00:00 2001 From: Riya Kumari Date: Tue, 26 Sep 2023 15:48:55 +0530 Subject: [PATCH 10/10] GOK-364 | Fix. Remove unnecessary await | [Sweety/Riya] --- src/utils/api-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/api-utils.js b/src/utils/api-utils.js index d05c7bc..e63462d 100644 --- a/src/utils/api-utils.js +++ b/src/utils/api-utils.js @@ -9,7 +9,7 @@ export const fetcher = async (url) => { if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } - return await response.json(); + return response.json(); }; const controller = new AbortController();