Web: Files: fixed undefined customer title

This commit is contained in:
Viktor Fomin 2021-01-13 16:32:13 +03:00
parent f3a2162537
commit 4d60745a11

View File

@ -88,10 +88,15 @@ const PureConnectDialogContainer = (props) => {
} = props;
const { corporate, title, link, token, provider_id, provider_key } = item;
const provider = providers.find(
(el) => el.provider_key === item.provider_key
);
const folderTitle = provider ? provider.customer_title : title;
const [urlValue, setUrlValue] = useState("");
const [loginValue, setLoginValue] = useState("");
const [passwordValue, setPasswordValue] = useState("");
const [customerTitle, setCustomerTitleValue] = useState(title);
const [customerTitle, setCustomerTitleValue] = useState(folderTitle);
const [isCorporate, setMakeShared] = useState(!!corporate);
const [oAuthToken, setToken] = useState(token);
@ -101,10 +106,6 @@ const PureConnectDialogContainer = (props) => {
const onChangeFolderName = (e) => setCustomerTitleValue(e.target.value);
const onChangeMakeShared = (e) => setMakeShared(!isCorporate);
const folderTitle = providers.find(
(el) => el.provider_key === item.provider_key
).customer_title;
const onSave = () => {
onClose();
setIsLoading(true);
@ -193,7 +194,7 @@ const PureConnectDialogContainer = (props) => {
<Text className="dialog-form-text">{t("ConnectFolderTitle")}</Text>
<TextInput
scale
value={`${folderTitle}`}
value={`${customerTitle}`}
onChange={onChangeFolderName}
/>
</div>