|
@@ -1,22 +1,4 @@
|
|
|
-$(document).ready(function () {
|
|
|
- let token = getCookie('jwt_token');
|
|
|
- if(!token) {
|
|
|
- return;
|
|
|
- }
|
|
|
- axios({
|
|
|
- method: 'post',
|
|
|
- url: 'http://www.choozmo.com:8887/user_profile',
|
|
|
- headers: {
|
|
|
- 'accept': 'text/html',
|
|
|
- 'Authorization': `Bearer ${token}`
|
|
|
- }
|
|
|
-}).then(res => {
|
|
|
- var userName='';
|
|
|
- console.log(res.data.user_info.userName);
|
|
|
- userName+=' <h2 class="user-name text-white mt-4 fw-bold">Hello,'+res.data.user_info.userName+'</h2>';
|
|
|
- $('.userName').html(userName);
|
|
|
- })
|
|
|
-});
|
|
|
+checkRoute();
|
|
|
|
|
|
function checkRoute() {
|
|
|
jwt_token = get_jwt_token();
|
|
@@ -35,13 +17,14 @@ function checkRoute() {
|
|
|
if(res.status !== 200) {
|
|
|
window.location.replace("login.html");
|
|
|
}
|
|
|
+ var userName='';
|
|
|
+ userName+=' <h2 class="user-name text-white mt-4 fw-bold">Hello,'+res.data.user_info.userName+'</h2>';
|
|
|
+ $('.userName').html(userName);
|
|
|
}).catch(err => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-checkRoute();
|
|
|
-
|
|
|
const btnLoginPage = document.querySelector('.btn-login');
|
|
|
const btnUserProfile = document.querySelector('.btn-userProfile');
|
|
|
const btnLogout = document.querySelector('.btn-logout');
|
|
@@ -312,7 +295,7 @@ var loaded_data = ''
|
|
|
function openNav() {
|
|
|
document.getElementById("mySidenav").style.width = "250px";
|
|
|
document.querySelector('.loader').style.display = "block";
|
|
|
- $.get("/history_input", function (data, status) {
|
|
|
+ $.get("http://www.choozmo.com:8887/history_input", function (data, status) {
|
|
|
console.log(data)
|
|
|
loaded_data = data
|
|
|
for (var obj of data) {
|