add settings.json
This commit is contained in:
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>React App</title><link rel="icon" href="favicon.ico"><script defer="defer" src="main.2d9157c3.js"></script></head><body><div id="root"></div><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-M6E6PDB6Y4")</script><script async src="https://www.googletagmanager.com/gtag/js?id=G-M6E6PDB6Y4"></script></body></html>
|
<!doctype html><html lang="en"><head><meta charset="UTF-8"><title>React App</title><link rel="icon" href="favicon.ico"><script defer="defer" src="main.3ab1a28d.js"></script></head><body><div id="root"></div><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-M6E6PDB6Y4")</script><script async src="https://www.googletagmanager.com/gtag/js?id=G-M6E6PDB6Y4"></script></body></html>
|
||||||
File diff suppressed because one or more lines are too long
3
dist/settings.json
vendored
Normal file
3
dist/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"API_URL": "https://tn-alpha.idntty.org:8080/api/"
|
||||||
|
}
|
||||||
3
public/settings.json
Normal file
3
public/settings.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"API_URL": "https://tn-alpha.idntty.org:8080/api/"
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import { Buffer } from 'buffer';
|
|||||||
import { HashRouter as Router } from 'react-router-dom';
|
import { HashRouter as Router } from 'react-router-dom';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import { store } from './store/store';
|
import { store } from './store/store';
|
||||||
|
import { fetchWrapper } from './shared/fetchWrapper';
|
||||||
|
|
||||||
globalThis.Buffer = Buffer;
|
globalThis.Buffer = Buffer;
|
||||||
|
|
||||||
@@ -13,6 +14,10 @@ BigInt.prototype.toJSON = function () {
|
|||||||
return this.toString();
|
return this.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fetch('settings.json')
|
||||||
|
.then((e) => e.json())
|
||||||
|
.then((data) => (fetchWrapper.baseUrl = data.API_URL))
|
||||||
|
.then(() =>
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<Router>
|
<Router>
|
||||||
@@ -20,4 +25,5 @@ ReactDOM.render(
|
|||||||
</Router>
|
</Router>
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
document.getElementById('root')
|
document.getElementById('root')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { jsonReplacer } from '../utils/Utils';
|
|||||||
|
|
||||||
function prepareUrl(url) {
|
function prepareUrl(url) {
|
||||||
if (url.startsWith('http')) return url;
|
if (url.startsWith('http')) return url;
|
||||||
return `${window.location.origin}/api/${url}`;
|
return `${fetchWrapper.baseUrl}${url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRequest(method, url, headers, attempts, token, body) {
|
function handleRequest(method, url, headers, attempts, token, body) {
|
||||||
@@ -115,3 +115,5 @@ export const fetchWrapper = {
|
|||||||
putAuth,
|
putAuth,
|
||||||
baseUrl: '',
|
baseUrl: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fetchWrapper.baseUrl = `${window.location.origin}/api/`;
|
||||||
|
|||||||
Reference in New Issue
Block a user