Set favicon when loading APPM UI

4.x.x
Jayasanka 5 years ago
parent 22ef153d80
commit 13bdeee883

@ -64,6 +64,7 @@ class App extends React.Component {
} }
componentDidMount() { componentDidMount() {
this.updateFavicon();
axios.get( axios.get(
window.location.origin + "/publisher/public/conf/config.json", window.location.origin + "/publisher/public/conf/config.json",
).then(res => { ).then(res => {
@ -130,6 +131,14 @@ class App extends React.Component {
}); });
}; };
updateFavicon = () =>{
const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = window.location.origin+'/devicemgt/public/uuf.unit.favicon/img/favicon.png';
document.getElementsByTagName('head')[0].appendChild(link);
};
render() { render() {
const {loading, error} = this.state; const {loading, error} = this.state;

@ -34,7 +34,7 @@ import {
Select Select
} from 'antd'; } from 'antd';
import axios from "axios"; import axios from "axios";
import {withConfigContext} from "../../../../context/ConfigContext"; import {withConfigContext} from "../../../context/ConfigContext";
const {TextArea} = Input; const {TextArea} = Input;
const InputGroup = Input.Group; const InputGroup = Input.Group;

@ -64,6 +64,7 @@ class App extends React.Component {
} }
componentDidMount() { componentDidMount() {
this.updateFavicon();
axios.get( axios.get(
window.location.origin + "/store/public/conf/config.json", window.location.origin + "/store/public/conf/config.json",
).then(res => { ).then(res => {
@ -77,6 +78,14 @@ class App extends React.Component {
}); });
} }
updateFavicon = () =>{
const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = window.location.origin+'/devicemgt/public/uuf.unit.favicon/img/favicon.png';
document.getElementsByTagName('head')[0].appendChild(link);
};
checkUserLoggedIn = (config) => { checkUserLoggedIn = (config) => {
axios.post( axios.post(
window.location.origin + "/store-ui-request-handler/user", window.location.origin + "/store-ui-request-handler/user",

Loading…
Cancel
Save