adds link element to frontend header if services exposes /custom.css endpoint

This commit is contained in:
Mose Müller 2023-10-17 11:48:07 +02:00
parent 6e14837e15
commit 785ed92b45

View File

@ -129,6 +129,20 @@ const App = () => {
.then((response) => response.json())
.then((data: DataServiceJSON) => dispatch({ type: 'SET_DATA', data }));
// Allow the user to add a custom css file
fetch(`http://${hostname}:${port}/custom.css`)
.then((response) => {
if (response.ok) {
// If the file exists, create a link element for the custom CSS
const link = document.createElement('link');
link.href = `http://${hostname}:${port}/custom.css`;
link.type = 'text/css';
link.rel = 'stylesheet';
document.head.appendChild(link);
}
})
.catch(console.error); // Handle the error appropriately
socket.on('notify', onNotify);
socket.on('exception', onException);