Browse Source

update html title

pull/1/head
farhantock 8 months ago
parent
commit
08d1994fae
  1. BIN
      public/OSPRO.ico
  2. 4
      public/index.html
  3. 2
      src/App.js
  4. 2
      src/containers/DefaultLayout/DefaultLayout.js
  5. 2
      src/routes.js
  6. 16
      src/views/Pages/Login/Login.js

BIN
public/OSPRO.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

4
public/index.html

@ -8,13 +8,13 @@
<meta name="description" content="OSPRO">
<meta name="author" content="Integrasia Utama">
<meta name="keyword" content="OSPRO,Integrasia,OSLOG,Asset,WebGIS,Aplikasi,Tracking System">
<title id="title"></title>
<title id="title">OSPRO</title>
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/simpro-icon.ico">
<link rel="shortcut icon" href="%PUBLIC_URL%/OSPRO.ico">
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon_bmd_denpasar.ico"> -->
<link rel="stylesheet" href="https://unpkg.com/@coreui/icons@1.0.0/css/all.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"

2
src/App.js

@ -27,11 +27,9 @@ class App extends Component {
const htmlTitle = data.html_title || 'OSPRO';
document.title = htmlTitle;
} else {
console.log('No data found in localStorage for key "configApp".');
document.title = 'OSPRO';
}
} catch (error) {
console.error('Error in componentDidMount:', error);
document.title = 'OSPRO';
}
}

2
src/containers/DefaultLayout/DefaultLayout.js

@ -118,6 +118,8 @@ class DefaultLayout extends Component {
e.preventDefault()
}
await localStorage.removeItem("role_id");
await localStorage.removeItem("company_id");
document.getElementById('title').innerText = 'OSPRO';
await window.localStorage.clear();
this.props.history.replace('/login')
}

2
src/routes.js

@ -22,7 +22,7 @@ const Layer = React.lazy(() => import('./views/Layers/Layer'));
const Layers = React.lazy(() => import('./views/Layers/Layers'));
const Lembur = React.lazy(() => import('./views/Master/MasterLembur'));
const MapConfig = React.lazy(() => import('./views/MapConfig'));
const Menu = React.lazy(() => import('./views/Master/MasterMenu'));
const Menu = React.lazy(() => import('./views/Master/MenuCompany'));
const OfficeHours = React.lazy(() => import('./views/Master/MasterOfficeHours'));
const Organization = React.lazy(() => import('./views/Master/MasterOrganization'));
const PanicButton = React.lazy(() => import('./views/SimproV2/PanicButton'));

16
src/views/Pages/Login/Login.js

@ -58,6 +58,21 @@ class Login extends Component {
this.handleChange = this.handleChange.bind(this);
this.showHide = this.showHide.bind(this);
}
updatePageTitle = () => {
try {
const storedData = localStorage.getItem('configApp');
if (storedData !== null) {
const data = JSON.parse(storedData);
const htmlTitle = data.html_title || 'OSPRO';
console.log('htmlTitle', htmlTitle);
document.getElementById('title').innerText = htmlTitle;
} else {
document.title = 'OSPRO';
}
} catch (error) {
document.title = 'OSPRO';
}
}
showHide(e) {
e.preventDefault();
e.stopPropagation();
@ -255,6 +270,7 @@ class Login extends Component {
window.localStorage.setItem('all_project', data_user.role.all_project);
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy));
window.localStorage.setItem('configApp', JSON.stringify(data_user.configApp));
this.updatePageTitle();
} else {
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');
NotificationManager.error(doLogin.data.message, 'Login Failed!');

Loading…
Cancel
Save