Skip to content

Commit

Permalink
prevent city name loss
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDmz committed Mar 24, 2022
1 parent 88fde65 commit 37540a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pearl",
"version": "0.5.2",
"version": "0.5.3",
"private": true,
"dependencies": {
"@date-io/date-fns": "1.x",
Expand Down
7 changes: 3 additions & 4 deletions src/components/panel-body/UEpage/forms/addressForm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Button, DialogActions, DialogTitle, makeStyles, TextField } from '@material-ui/core';
import { Button, DialogActions, DialogTitle, TextField, makeStyles } from '@material-ui/core';
import React, { useContext, useState } from 'react';

import D from 'i18n';
import PropTypes from 'prop-types';
import React, { useContext, useState } from 'react';
import SurveyUnitContext from '../UEContext';

const useStyles = makeStyles(() => ({
Expand All @@ -14,8 +15,6 @@ const useStyles = makeStyles(() => ({
const Form = ({ closeModal, save, previousValue }) => {
const { surveyUnit } = useContext(SurveyUnitContext);

/** previousValue =[ { label: D.anyOne , value: realValue }, {}, ... ] */
/** previousData = { D.anyOne: realValue , D.anotherOne: anotherRealValue } */
const previousData = previousValue.reduce(
(obj, { label, value }) => ({ ...obj, [label]: value }),
{}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/functions/surveyUnitFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ export const isSelectable = su => {
};

export const getAddressData = su => {
const [postCode, cityName] = su.address.l6.split(' ');
const [postCode, ...rest] = su.address.l6.split(' ');
const cityName = rest.join(' ');

return [
{ label: D.addressDeliveryPoint, value: su.address.l2 || '' },
Expand Down

0 comments on commit 37540a8

Please sign in to comment.