mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
adds link element to frontend header if services exposes /custom.css endpoint
This commit is contained in:
parent
6e14837e15
commit
785ed92b45
@ -129,6 +129,20 @@ const App = () => {
|
|||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data: DataServiceJSON) => dispatch({ type: 'SET_DATA', data }));
|
.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('notify', onNotify);
|
||||||
socket.on('exception', onException);
|
socket.on('exception', onException);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user