From aa6689e6158efde28b68948cd8b67d55080158d2 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Sat, 5 Jun 2021 16:28:45 +0530 Subject: Removed hardcoded strings and reused constants defined in config.js (#1499) --- src/components/auth/AuthLayout.js | 3 ++- src/components/auth/ChangeServer.js | 5 +++-- src/components/auth/Login.js | 7 ++++--- src/components/auth/Signup.js | 8 +++----- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/components/auth') diff --git a/src/components/auth/AuthLayout.js b/src/components/auth/AuthLayout.js index 4783fc6a0..6fa3adf92 100644 --- a/src/components/auth/AuthLayout.js +++ b/src/components/auth/AuthLayout.js @@ -12,6 +12,7 @@ import globalMessages from '../../i18n/globalMessages'; import { isWindows } from '../../environment'; import AppUpdateInfoBar from '../AppUpdateInfoBar'; +import { GITHUB_FERDI_URL } from '../../config'; export default @observer class AuthLayout extends Component { static propTypes = { @@ -94,7 +95,7 @@ export default @observer class AuthLayout extends Component { })} {/* */} - + diff --git a/src/components/auth/ChangeServer.js b/src/components/auth/ChangeServer.js index 68c2303a4..0dedd825a 100644 --- a/src/components/auth/ChangeServer.js +++ b/src/components/auth/ChangeServer.js @@ -8,6 +8,7 @@ import Select from '../ui/Select'; import Button from '../ui/Button'; import Infobox from '../ui/Infobox'; import { url, required } from '../../helpers/validation-helpers'; +import { LIVE_FERDI_API, LIVE_FRANZ_API } from '../../config'; const messages = defineMessages({ headline: { @@ -47,9 +48,9 @@ export default @observer class ChangeServer extends Component { intl: intlShape, }; - ferdiServer='https://api.getferdi.com'; + ferdiServer=LIVE_FERDI_API; - franzServer='https://api.franzinfra.com'; + franzServer=LIVE_FRANZ_API; defaultServers=[this.franzServer, this.ferdiServer]; diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 23fdfcac7..52b09eab6 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js @@ -4,7 +4,8 @@ import PropTypes from 'prop-types'; import { observer, inject } from 'mobx-react'; import { defineMessages, intlShape } from 'react-intl'; -import { isDevMode, useLiveAPI } from '../../environment'; +import { LIVE_FRANZ_API } from '../../config'; +import { API_VERSION, isDevMode, useLiveAPI } from '../../environment'; import Form from '../../lib/Form'; import { required, email } from '../../helpers/validation-helpers'; import serverlessLogin from '../../helpers/serverless-helpers'; @@ -164,12 +165,12 @@ export default @inject('actions') @observer class Login extends Component { {error.code === 'invalid-credentials' && ( <>

{intl.formatMessage(messages.invalidCredentials)}

- { window.ferdi.stores.settings.all.app.server !== 'https://api.franzinfra.com' && ( + { window.ferdi.stores.settings.all.app.server !== LIVE_FRANZ_API && (

{intl.formatMessage(messages.customServerQuestion)} {' '} diff --git a/src/components/auth/Signup.js b/src/components/auth/Signup.js index 6a7db5cde..140867ea1 100644 --- a/src/components/auth/Signup.js +++ b/src/components/auth/Signup.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { observer, inject } from 'mobx-react'; import { defineMessages, intlShape } from 'react-intl'; -import { isDevMode, useLiveAPI } from '../../environment'; +import { isDevMode, termsBase, useLiveAPI } from '../../environment'; import Form from '../../lib/Form'; import { required, email, minLength } from '../../helpers/validation-helpers'; import serverlessLogin from '../../helpers/serverless-helpers'; @@ -135,8 +135,6 @@ export default @inject('actions') @observer class Signup extends Component { isSubmitting, loginRoute, error, changeServerRoute, } = this.props; - const termsBase = window.ferdi.stores.settings.all.app.server !== 'https://api.franzinfra.com' ? window.ferdi.stores.settings.all.app.server : 'https://meetfranz.com'; - return (

@@ -183,7 +181,7 @@ export default @inject('actions') @observer class Signup extends Component { {intl.formatMessage(messages.legalInfo)}
@@ -191,7 +189,7 @@ export default @inject('actions') @observer class Signup extends Component {  &  -- cgit v1.2.3-70-g09d2