|
@@ -14,6 +14,7 @@ let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
|
|
|
|
|
|
|
|
function checkLocal() {
|
|
function checkLocal() {
|
|
|
if(userBasics.length == 0){ return };
|
|
if(userBasics.length == 0){ return };
|
|
|
|
|
+ console.log(userBasics);
|
|
|
$('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
|
|
$('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -39,8 +40,8 @@ checkLan();
|
|
|
function renderView() {
|
|
function renderView() {
|
|
|
let token = getCookie('jwt_token');
|
|
let token = getCookie('jwt_token');
|
|
|
if(!token) {
|
|
if(!token) {
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ window.location.replace("login.html");
|
|
|
|
|
+ }
|
|
|
axios({
|
|
axios({
|
|
|
method: 'post',
|
|
method: 'post',
|
|
|
url: 'https://www.choozmo.com:8887/user_profile',
|
|
url: 'https://www.choozmo.com:8887/user_profile',
|
|
@@ -50,7 +51,10 @@ function renderView() {
|
|
|
}
|
|
}
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
console.log(res.data);
|
|
console.log(res.data);
|
|
|
- const userInfo = res.data;
|
|
|
|
|
|
|
+ let userInfo = res.data;
|
|
|
|
|
+ if(!userInfo.user_info) {
|
|
|
|
|
+ window.location.replace("login.html");
|
|
|
|
|
+ }
|
|
|
localStorage.setItem('user_profile', JSON.stringify(res.data));
|
|
localStorage.setItem('user_profile', JSON.stringify(res.data));
|
|
|
if(userInfo.user_info.left_sec < 20){
|
|
if(userInfo.user_info.left_sec < 20){
|
|
|
let title = "剩餘秒數不足";
|
|
let title = "剩餘秒數不足";
|
|
@@ -152,6 +156,7 @@ function renderView() {
|
|
|
$('.card-profile').html(str);
|
|
$('.card-profile').html(str);
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
console.log(err);
|
|
console.log(err);
|
|
|
|
|
+ window.location.replace("login.html");
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|