Browse Source

get local and fix

huaisianhuang 3 năm trước cách đây
mục cha
commit
505645587b

+ 2 - 0
html/index_eng.html

@@ -3,6 +3,8 @@
 <head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <meta http-equiv="X-UA-Compatible" content="ie=edge, Chrome=1">
+    <meta http-equiv="Cache-Control" content="no-cache">
   <title>AI ANCHOR GO</title>
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"

+ 5 - 3
html/script_eng.js

@@ -1,11 +1,13 @@
 checkRoute();
 
 let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
-if(userBasics !== []){
-  $('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
-}
 
 
+  //userBasics = JSON.parse(userBasics);
+if(userBasics !== [] || typeOf(userBasics) !== 'string'){
+  $('.userName').html(`<h2 class="user-name text-white mt-lg-3 mt-xl-1 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
+}
+
 function checkRoute() {
   let jwt_token = get_jwt_token();
   if(jwt_token == undefined) {

+ 4 - 5
html/script_long.js

@@ -2,12 +2,11 @@
 
 let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
 
-(function() {
-    if(userBasics !== []){
-        $('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
-    }
-})();
 
+  //userBasics = JSON.parse(userBasics);
+if(userBasics !== [] || typeOf(userBasics) !== 'string'){
+  $('.userName').html(`<h2 class="user-name text-white mt-lg-3 mt-xl-1 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
+}
 
 function checkRoute() {
   let jwt_token = get_jwt_token();

+ 5 - 3
html/script_profile.js

@@ -15,8 +15,10 @@ let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
 function checkLocal() {
   if(userBasics.length == 0){ return };
   //userBasics = JSON.parse(userBasics);
-  console.log(userBasics);
-  //$('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
+  if(userBasics !== [] && typeof(userBasics) !== 'string') {
+    console.log(typeof(userBasics));
+    $('.userName').html(`<h2 class="user-name text-white mt-4 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
+  }
 }
 
 $('.dropdown-toggle').click(() => {
@@ -24,7 +26,7 @@ $('.dropdown-toggle').click(() => {
   checkLan();
 });
 
-//checkLocal();
+checkLocal();
 
 function checkLan() {
   if(lan == 'en') {

+ 2 - 1
html/static/script_slides.js

@@ -1,7 +1,8 @@
 checkRoute();
 
 let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
-if(userBasics !== []){
+  //userBasics = JSON.parse(userBasics);
+if(userBasics !== [] && typeof(userBasics) !== 'string'){
   $('.userName').html(`<h2 class="user-name text-white mt-lg-3 mt-xl-1 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
 }
 

+ 4 - 1
html/static/script_slides_eng.js

@@ -1,7 +1,10 @@
 checkRoute();
 
 let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
-if(userBasics !== []){
+
+
+  //userBasics = JSON.parse(userBasics);
+if(userBasics !== [] && typeof(userBasics) !== 'string'){
   $('.userName').html(`<h2 class="user-name text-white mt-lg-3 mt-xl-1 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
 }
 

+ 2 - 2
html/static/script_util.js

@@ -3,9 +3,9 @@ checkRoute();
 let userBasics = JSON.parse(localStorage.getItem('user_profile')) || [];
 
 
-/* if(userBasics !== []){
+ if(userBasics !== [] && typeof(userBasics) !== 'string'){
   $('.userName').html(`<h2 class="user-name text-white mt-lg-3 mt-xl-1 fw-bold">Hi ${userBasics.user_info.userName}</h2>`);
-} */
+} 
 
 
 function checkRoute() {