Advertisement
mcin_lalallala

Untitled

Jul 21st, 2020
2,645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.   const getAddress = (e: ILocationDetailsDto): string => {
  3.     e.street = "Octowa";
  4.     e.apartmentNumber = "21";
  5.     e.streetNumber = "12";
  6.     let address = e.street;
  7.     if (e.street) address = e.street ? e.street : e.city;
  8.     if (e.streetNumber) address = address + ", " + e.streetNumber;
  9.     if (e.streetNumber && e.apartmentNumber) address = address + " / " + e.apartmentNumber;
  10.     else if (e.apartmentNumber) address = address + ", " + e.apartmentNumber;
  11.  
  12.     return address;
  13.   };
  14.  
  15.   useEffect(() => {
  16.     async function x() {
  17.       if (id) {
  18.         const e = await fetchEntity(id);
  19.         if (e) {
  20.           e.address = getAddress(e);
  21.           setEntity(e);
  22.         } else setNoData(true);
  23.       }
  24.     }
  25.     x();
  26.  
  27.     // eslint-disable-next-line react-hooks/exhaustive-deps
  28.   }, []);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement