Browse Source

本地免跳转预览

李富豪 5 months ago
parent
commit
444a9defb4
1 changed files with 6 additions and 5 deletions
  1. 6 5
      app/components/home.tsx

+ 6 - 5
app/components/home.tsx

@@ -1,6 +1,6 @@
 "use client";
 
-import { Modal} from "antd";
+import { Modal } from "antd";
 
 require("../polyfill");
 import { useState, useEffect } from "react";
@@ -316,20 +316,21 @@ export function Home() {
   const jkLogin = async (data: { code: string, redirectUrl: string }, url: string) => {
     try {
       const res = await api.post('jk_code_login', data);
-      console.log(res,'res')
       localStorage.setItem('userInfo', JSON.stringify(res.data));
       window.open(url, '_self');
-    } catch (error:any) {
+    } catch (error: any) {
       Modal.error({
         title: '登录失败',
         content: error.msg,
       })
-      // const originUrl = window.location.origin;
-      // window.open(originUrl, '_self');
     }
   }
 
   useEffect(() => {
+    // const loginRes = null;
+    // if (loginRes) {
+    //   return localStorage.setItem('userInfo', JSON.stringify(loginRes));
+    // }
     const originUrl = window.location.origin;
     const fullUrl = window.location.href;
     const urlParams = new URLSearchParams(new URL(fullUrl).search);