Merge branch 'mm-frontend-api-root' into 'master'

Use relative base url for backend

See merge request BI-IDO/bi-ido-flight-log-public!7
This commit is contained in:
Ing. Jiří Mlejnek 2023-11-06 18:47:02 +01:00
commit dff04667db
4 changed files with 24 additions and 23 deletions

View file

@ -9,5 +9,5 @@
</head> </head>
<body aurelia-app="main"> <body aurelia-app="main">
<script type="text/javascript" src="/app.768a36b72f06ac99edf3.bundle.js"></script><script type="text/javascript" src="/vendor.ba835e659bca766e203c.bundle.js"></script></body> <script type="text/javascript" src="/app.bundle.js"></script><script type="text/javascript" src="/vendor.ba835e659bca766e203c.bundle.js"></script></body>
</html> </html>

View file

@ -1,7 +1,7 @@
import environment from './environment'; import environment from './environment';
import {PLATFORM} from 'aurelia-pal'; import { PLATFORM } from 'aurelia-pal';
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import {HttpClient} from 'aurelia-fetch-client'; import { HttpClient } from 'aurelia-fetch-client';
// remove out if you don't want a Promise polyfill (remove also from webpack.config.js) // remove out if you don't want a Promise polyfill (remove also from webpack.config.js)
@ -17,24 +17,24 @@ export function configure(aurelia) {
let http = new HttpClient(); let http = new HttpClient();
http.configure(config => { http.configure(config => {
config config
.useStandardConfiguration() .useStandardConfiguration()
.withBaseUrl('http://localhost:8081/') .withBaseUrl('/') // It used to be http://localhost:8081, but let it use default host
.withDefaults({ .withDefaults({
headers: { headers: {
'Accept': 'application/json' 'Accept': 'application/json'
} }
}) })
.withInterceptor({ .withInterceptor({
request(request) { request(request) {
console.log(`Requesting ${request.method} ${request.url}`); console.log(`Requesting ${request.method} ${request.url}`);
return request; return request;
}, },
response(response) { response(response) {
console.log(`Received ${response.status} ${response.url}`); console.log(`Received ${response.status} ${response.url}`);
return response; return response;
} }
}); });
}); });
container.registerInstance(HttpClient, http); container.registerInstance(HttpClient, http);

0
mvnw vendored Normal file → Executable file
View file