auto discover url in frontend

This commit is contained in:
philipredstone
2025-04-15 14:26:10 +02:00
parent 845bfb856e
commit 524dc010d0
5 changed files with 29 additions and 4 deletions

View File

@ -1,6 +1,10 @@
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL || 'http://localhost:5000/api';
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = window.location.port;
const API_URL = protocol + '//' + hostname + (port ? ':' + port : '') + '/api';
// Configure axios
axios.defaults.withCredentials = true;

View File

@ -1,6 +1,10 @@
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL || 'http://localhost:5000/api';
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = window.location.port;
const API_URL = protocol + '//' + hostname + (port ? ':' + port : '') + '/api';
// Types
export interface Network {

View File

@ -1,6 +1,10 @@
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL || 'http://localhost:5000/api';
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = window.location.port;
const API_URL = protocol + '//' + hostname + (port ? ':' + port : '') + '/api';
// Types
export interface Person {

View File

@ -1,6 +1,10 @@
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL || 'http://localhost:5000/api';
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = window.location.port;
const API_URL = protocol + '//' + hostname + (port ? ':' + port : '') + '/api';
// Types
export interface Relationship {