Explorar el Código

fix: getQuestion with id_token

Arsekl hace 3 años
padre
commit
2200240e05
Se han modificado 4 ficheros con 10 adiciones y 4 borrados
  1. 1 0
      src/api/index.ts
  2. 7 1
      src/pages/index.tsx
  3. 1 2
      src/pages/seec/result.tsx
  4. 1 1
      src/utils/index.ts

+ 1 - 0
src/api/index.ts

@@ -178,6 +178,7 @@ const api = {
     },
 
     async test(examId: number, questionId: number):Promise<any> {
+        http.get(`${apiPath}/auth/current`)
         return new Promise((resolve) => {
             setTimeout(() => {
                 resolve(JSON.parse("{\"err\":0,\n" +

+ 7 - 1
src/pages/index.tsx

@@ -57,9 +57,12 @@ export default function HomePage() {
         }
         if (history.location.query?.id_token) {
             setCookie('token', history.location.query?.id_token as string)
+            if (history.location.query?.examId && history.location.query?.questionId) {
+                getQuestion(history.location.query?.examId as string, history.location.query?.questionId as string)
+            }
             history.push('/')
         }
-        if (history.location.query?.examId && history.location.query?.questionId) {
+        else if (history.location.query?.examId && history.location.query?.questionId) {
             getQuestion(history.location.query?.examId as string, history.location.query?.questionId as string)
             history.push('/')
         }
@@ -69,6 +72,9 @@ export default function HomePage() {
             }
             if (history.location.query?.id_token) {
                 setCookie('token', history.location.query?.id_token as string)
+                if (history.location.query?.examId && history.location.query?.questionId) {
+                    getQuestion(history.location.query?.examId as string, history.location.query?.questionId as string)
+                }
                 history.push('/')
             }
         });

+ 1 - 2
src/pages/seec/result.tsx

@@ -107,8 +107,7 @@ export default () => {
                         <Button type = "primary" disabled={loading} onClick={() => showConsoleOutput()}>
                             Console
                         </Button>,
-                        <Button loading={loading}>
-                            <SyncOutlined onClick={() => handleRefresh()} />
+                        <Button shape="circle" icon={<SyncOutlined />} loading={loading} onClick={() => handleRefresh()}>
                         </Button>
                     ]
                 }}

+ 1 - 1
src/utils/index.ts

@@ -60,7 +60,7 @@ export function goToLogin() {
                     {
                         id: 'logout',
                         icon: 'log-out',
-                        name: '登出',
+                        name: 'log out',
                         onClick: () => {
                             store.dispatch(loadUser({}))
                             deleteCookie('token')