diff options
author | Vijay A <vraravam@users.noreply.github.com> | 2023-05-25 13:04:39 +0530 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2023-05-25 13:04:39 +0530 |
commit | 44c5193ab8b25422ae5cb679ce788a8c636108ac (patch) | |
tree | dc29c85d019bb5f807d7f2041eaf3ebba3215431 /src/components | |
parent | Bump eslint-plugin-unicorn from 42.0.0 to 46.0.0 (diff) | |
download | ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.gz ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.zst ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.zip |
Minor refactoring to remove code duplication
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/settings/services/EditServiceForm.tsx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/components/settings/services/EditServiceForm.tsx b/src/components/settings/services/EditServiceForm.tsx index 2b87dff1e..c04a53b50 100644 --- a/src/components/settings/services/EditServiceForm.tsx +++ b/src/components/settings/services/EditServiceForm.tsx | |||
@@ -2,7 +2,6 @@ import { Component, FormEvent, ReactElement } from 'react'; | |||
2 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
3 | import { Link } from 'react-router-dom'; | 3 | import { Link } from 'react-router-dom'; |
4 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; | 4 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; |
5 | import normalizeUrl from 'normalize-url'; | ||
6 | import { mdiInformation } from '@mdi/js'; | 5 | import { mdiInformation } from '@mdi/js'; |
7 | import { noop } from 'lodash'; | 6 | import { noop } from 'lodash'; |
8 | import Form from '../../../lib/Form'; | 7 | import Form from '../../../lib/Form'; |
@@ -20,6 +19,7 @@ import Icon from '../../ui/icon'; | |||
20 | import { H3 } from '../../ui/headline'; | 19 | import { H3 } from '../../ui/headline'; |
21 | import { IRecipe } from '../../../models/Recipe'; | 20 | import { IRecipe } from '../../../models/Recipe'; |
22 | import Service from '../../../models/Service'; | 21 | import Service from '../../../models/Service'; |
22 | import { normalizedUrl } from '../../../helpers/url-helpers'; | ||
23 | 23 | ||
24 | const messages = defineMessages({ | 24 | const messages = defineMessages({ |
25 | saveService: { | 25 | saveService: { |
@@ -194,11 +194,7 @@ class EditServiceForm extends Component<IProps, IState> { | |||
194 | if (recipe.validateUrl && values.customUrl) { | 194 | if (recipe.validateUrl && values.customUrl) { |
195 | this.setState({ isValidatingCustomUrl: true }); | 195 | this.setState({ isValidatingCustomUrl: true }); |
196 | try { | 196 | try { |
197 | values.customUrl = normalizeUrl(values.customUrl, { | 197 | values.customUrl = normalizedUrl(values.customUrl); |
198 | stripAuthentication: false, | ||
199 | stripWWW: false, | ||
200 | removeTrailingSlash: false, | ||
201 | }); | ||
202 | isValid = await recipe.validateUrl(values.customUrl); | 198 | isValid = await recipe.validateUrl(values.customUrl); |
203 | } catch (error) { | 199 | } catch (error) { |
204 | console.warn('ValidateURL', error); | 200 | console.warn('ValidateURL', error); |