From 2ab859c2ead12b362f1e4b6fa8bd538a6f4dc58d Mon Sep 17 00:00:00 2001 From: Ibrahim Bali Date: Sun, 12 Feb 2023 15:54:51 +0300 Subject: [PATCH 1/7] refactor: increase shared code piece --- src/components/LocationEdit.jsx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/LocationEdit.jsx b/src/components/LocationEdit.jsx index 4c82a22..5fe62db 100644 --- a/src/components/LocationEdit.jsx +++ b/src/components/LocationEdit.jsx @@ -42,7 +42,7 @@ export function LocationsEdit ({ item }) { return; } - if (name === "additionalAddressDetails") { + if (name === "addressDetails") { setFormData({ ...formData, [name]: value, addressDetails: value }); return; } @@ -56,7 +56,7 @@ export function LocationsEdit ({ item }) { "name", "phone", "address", - "additionalAddressDetails", + "addressDetails", "cityId", "districtId", "typeId", @@ -112,7 +112,6 @@ export function LocationsEdit ({ item }) {

Lokasyon Düzenle

-
@@ -130,10 +129,9 @@ export function LocationsEdit ({ item }) { value={formData.address} onChange={handleInputChange}/>
- - Adres Tarifi: +
@@ -194,7 +192,7 @@ export function LocationsEdit ({ item }) { { formData.typeId && @@ -225,14 +223,18 @@ export function LocationsEdit ({ item }) { }
+ - {loading &&

Güncelleniyor...

} + + { + loading &&
Kaydediliyor...
+ } + { - response?.ok && data?.ok && -
Güncelleme başarılı
+ response?.ok && data?.ok &&
Kayıt başarılı
}
From 043676819412055562cc26946aeafed7f9b988d8 Mon Sep 17 00:00:00 2001 From: Ibrahim Bali Date: Tue, 14 Feb 2023 21:50:58 +0300 Subject: [PATCH 2/7] refactor(Location): increase shared code size --- src/components/LocationAdd.jsx | 5 +++-- src/components/LocationEdit.jsx | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/LocationAdd.jsx b/src/components/LocationAdd.jsx index 39630c4..e13b43c 100644 --- a/src/components/LocationAdd.jsx +++ b/src/components/LocationAdd.jsx @@ -242,8 +242,9 @@ export function LocationAdd ({refresh}) { Lütfen seçiniz { - [{ id: "true", name: "Evet" }, { id: "false", name: "Hayır" }] - .map((item) => ( + [{ id: true, name: "Evet" }, { id: false, name: "Hayır" }] + .map((item) => + ( { - [{ id: true, name: "Evet" }, { id: false, name: "Hayır" }].map( - (item) => ( + [{ id: true, name: "Evet" }, { id: false, name: "Hayır" }] + .map((item) => + (