Browse Source

[edit] discord

wenliming 3 years ago
parent
commit
5f5732bd68
2 changed files with 25 additions and 22 deletions
  1. 24 21
      src/logic/background/twitter.js
  2. 1 1
      src/view/iframe/publish/give-dialog.vue

+ 24 - 21
src/logic/background/twitter.js

@@ -72,27 +72,30 @@ export function saveDiscordAuthWindowId (params) {
 export function discordLoginCode({code}, sender) {
     console.log('sender', sender)
     let {windowId, id} = sender.tab || {};
-    // chrome.tabs.remove(sender.tab.id)
-    if(windowId) {
-        chrome.windows.remove(
-            windowId,
-            function () {
-                // 发送请求
-                getDiscordUserInfo({
-                    authCode: code,
-                    redirectUrl: discordAuthRedirectUri
-                }).then(res => {
-                    if (res.code == 0) {
-                        setTimeout(() => {
-                            sendActivetabMessage({
-                                actionType: 'BACK_DISCORD_LOGIN_SUCCESS'    
-                            });
-                        })
-                    }
-                })
-            }
-        )
-    }
+    chrome.tabs.remove(id);
+
+    // 发送请求
+    getDiscordUserInfo({
+        authCode: code,
+        redirectUrl: discordAuthRedirectUri
+    }).then(res => {
+        if (res.code == 0) {
+            setTimeout(() => {
+                sendActivetabMessage({
+                    actionType: 'BACK_DISCORD_LOGIN_SUCCESS'    
+                });
+            })
+        }
+    })
+
+    // if(windowId) {
+    //     chrome.windows.remove(
+    //         windowId,
+    //         function () {
+                
+    //         }
+    //     )
+    // }
 }
 
 export function twitterShortUrl(sender, url) {

+ 1 - 1
src/view/iframe/publish/give-dialog.vue

@@ -1094,7 +1094,7 @@ const setDiscordErrTxt = (params = {showPop: false}) => {
                         iptErrMsgTxt.value = discordIptErrTxt;
                         iptErrType = 'discord';
                     } else {
-                        if(res.data.expires == null) {
+                        if(res.data.expires !== null) {
                             // 不是永久邀请链接
                             iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
                             iptErrType = '';