aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/settings
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2023-05-25 13:04:39 +0530
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2023-05-25 13:04:39 +0530
commit44c5193ab8b25422ae5cb679ce788a8c636108ac (patch)
treedc29c85d019bb5f807d7f2041eaf3ebba3215431 /src/components/settings
parentBump eslint-plugin-unicorn from 42.0.0 to 46.0.0 (diff)
downloadferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.gz
ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.zst
ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.zip
Minor refactoring to remove code duplication
Diffstat (limited to 'src/components/settings')
-rw-r--r--src/components/settings/services/EditServiceForm.tsx8
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';
2import { observer } from 'mobx-react'; 2import { observer } from 'mobx-react';
3import { Link } from 'react-router-dom'; 3import { Link } from 'react-router-dom';
4import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; 4import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl';
5import normalizeUrl from 'normalize-url';
6import { mdiInformation } from '@mdi/js'; 5import { mdiInformation } from '@mdi/js';
7import { noop } from 'lodash'; 6import { noop } from 'lodash';
8import Form from '../../../lib/Form'; 7import Form from '../../../lib/Form';
@@ -20,6 +19,7 @@ import Icon from '../../ui/icon';
20import { H3 } from '../../ui/headline'; 19import { H3 } from '../../ui/headline';
21import { IRecipe } from '../../../models/Recipe'; 20import { IRecipe } from '../../../models/Recipe';
22import Service from '../../../models/Service'; 21import Service from '../../../models/Service';
22import { normalizedUrl } from '../../../helpers/url-helpers';
23 23
24const messages = defineMessages({ 24const 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);