frontend api url
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<title>Papercrate</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="/config.js"></script>
|
||||
<main id="app"></main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -22,7 +22,12 @@ import {
|
||||
} from 'react-router-dom';
|
||||
import './styles.css';
|
||||
|
||||
const API_ROOT = (process.env.API_BASE_URL || '').replace(/\/$/, '');
|
||||
const runtimeApiBase =
|
||||
typeof window !== 'undefined' && window.__PAPERCRATE_API_BASE_URL
|
||||
? window.__PAPERCRATE_API_BASE_URL
|
||||
: '';
|
||||
|
||||
const API_ROOT = (runtimeApiBase || process.env.API_BASE_URL || '').replace(/\/$/, '');
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: API_ROOT ? `${API_ROOT}/api` : '/api',
|
||||
|
||||
Reference in New Issue
Block a user