andy пре 2 година
родитељ
комит
6fc21a53a0
2 измењених фајлова са 30 додато и 1 уклоњено
  1. 21 0
      liff2-taroboba-yuan/js/liff-functions.js
  2. 9 1
      liff2-taroboba-yuan/js/liff-init.js

+ 21 - 0
liff2-taroboba-yuan/js/liff-functions.js

@@ -1,3 +1,5 @@
+// const liffId = "1657279859-Nz2nKkQA";
+
 function getProfile() {
   liff
     .getProfile()
@@ -28,9 +30,26 @@ function sendMessage() {
     });
 }
 
+
 function login() {
   console.log('login');
   liff.login();
+  liff.login({
+    // 使用者登入後要去到哪個頁面
+    redirectUri: 'https://liff.googo.org/liff2-taroboba-yuan/'
+  });
+  // (async () => {
+  //   await liff.init({ liffId: liffId })
+  //   if (new URL(window.location).searchParams.get('liff.state')) return
+  //   const liffLoginRedirect = sessionStorage.getItem('liffLoginRedirect')
+  //   if (_.isString(liffLoginRedirect)) {
+  //     sessionStorage.removeItem('liffLoginRedirect')
+  //     location.href = liffLoginRedirect
+  //     console.log(liffLoginRedirect)
+  //   }
+
+  // })()
+
 }
 
 function scanCode() {
@@ -59,6 +78,8 @@ function logout() {
   if (liff.isLoggedIn()) {
     liff.logout();
     window.alert("Successfully to Logout");
+  
+
     location.reload();
   }
 }

+ 9 - 1
liff2-taroboba-yuan/js/liff-init.js

@@ -1,10 +1,14 @@
+
 // ----- Configuration Zone! -----
 // Don't forget to change this to your LIFF ID
 
-const liffId = "1657114132-2vvKr7Pe";
+// const liffId = "1657114132-2vvKr7Pe";
+const liffId = "1657279859-Nz2nKkQA";
+
 
 // Don't forget to change this to your LIFF ID
 
+
 liff.init(
   { liffId: liffId },
   () => {
@@ -14,6 +18,7 @@ liff.init(
     window.alert(err);
   }
 );
+
 function initLIFF() {
   if (liff.isLoggedIn()) {
     liff
@@ -21,6 +26,7 @@ function initLIFF() {
       .then(profile => {
         console.log('profile', profile);
         document.getElementById("profileImage").src = profile.pictureUrl;
+
         //        document.getElementById("userId").innerHTML = profile.userId;
         //      document.getElementById("displayName").innerHTML = profile.displayName;
         //      document.getElementById("statusMessage").innerHTML =
@@ -83,3 +89,5 @@ function initLIFF() {
     // document.getElementById("context_groupId").innerHTML = "No data.";
   }
 }
+
+