Add a fallback URL
This commit is contained in:
1 parent
8fcafc0694
commit
1cdb20e678
1 file changed
+3
@@ -1,5 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
const BASE_URL = import.meta.env.VITE_APP_API_BASE_URL;
|
||||||
|
const FALLBACK_BASE_URL = "http://localhost:5000/api/v1";
|
||||||
import { logger } from "./Logger";
|
import { logger } from "./Logger";
|
||||||
class NetworkService {
|
class NetworkService {
|
||||||
constructor(store) {
|
constructor(store) {
|
||||||
@@ -11,6 +12,8 @@ class NetworkService {
|
|||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
if (BASE_URL === undefined && state.settings.apiBaseUrl) {
|
if (BASE_URL === undefined && state.settings.apiBaseUrl) {
|
||||||
baseURL = state.settings.apiBaseUrl;
|
baseURL = state.settings.apiBaseUrl;
|
||||||
|
} else {
|
||||||
|
baseURL = FALLBACK_BASE_URL;
|
||||||
}
|
}
|
||||||
this.setBaseUrl(baseURL);
|
this.setBaseUrl(baseURL);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user