From 8ab680e9648adf342d3dbd42cd0ebe02e31a00a8 Mon Sep 17 00:00:00 2001
From: vantezzen
Date: Mon, 26 Aug 2019 21:25:59 +0200
Subject: Improve apibase function
---
src/api/apiBase.js | 9 ++++-----
src/components/settings/settings/EditSettingsForm.js | 5 +++++
2 files changed, 9 insertions(+), 5 deletions(-)
(limited to 'src')
diff --git a/src/api/apiBase.js b/src/api/apiBase.js
index ce02922ac..b40673e44 100644
--- a/src/api/apiBase.js
+++ b/src/api/apiBase.js
@@ -8,9 +8,11 @@ import {
const apiBase = () => {
let url;
+
if (!window.ferdi
|| !window.ferdi.stores.settings
- || !window.ferdi.stores.settings.all) {
+ || !window.ferdi.stores.settings.all
+ || !window.ferdi.stores.settings.all.app.server) {
// Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded
// "Why 1.1.1.1 as the default, invalid URL?"
// 1.1.1.1 is the server for Cloudflare's DNS service and will be the same across most networks.
@@ -20,12 +22,9 @@ const apiBase = () => {
// on some routes. This would result in Ferdi deleting its current authToken as it thinks it
// has gone invalid.
url = 'https://1.1.1.1';
- } else if (window.ferdi.stores.settings.all.app.server) {
+ } else {
// Load URL from store
url = window.ferdi.stores.settings.all.app.server;
- } else {
- // Use default server url
- url = API;
}
return `${url}/${API_VERSION}`;
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index de324b115..6d2dd0572 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -254,6 +254,11 @@ export default @observer class EditSettingsForm extends Component {
{intl.formatMessage(messages.languageDisclaimer)}
+
+
+ Ferdi is based on Franz, a project published
+ under the Apache-2.0 License
+
--
cgit v1.2.3-70-g09d2