Sfoglia il codice sorgente

优化开发登录

Michael Wang 3 anni fa
parent
commit
5a4a2ef366
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7 1
      src/devLogin.ts

+ 7 - 1
src/devLogin.ts

@@ -15,7 +15,13 @@ export async function initLogin() {
   f.append("password", password);
 
   return fetch("/login", { body: f, method: "POST" })
-    .then(async (r) => console.log(r))
+    .then(async (r) => {
+      const body = await r.text();
+      const exams = body.match(
+        /<select name="examId" id="exam-select">.*<\/select>/gims
+      );
+      console.log(exams && exams[0].replace(/\n/g, ""));
+    })
     .then(() => {
       const f = new FormData();
       f.append("examId", examId);