11import styles from "./auth.module.scss" ;
2- import { IconButton } from "../button/button" ;
2+ import { IconButton } from "../button/button" ;
33
4- import { NavigateFunction , useNavigate } from "react-router-dom" ;
5- import { Path } from "../../constant" ;
4+ import { NavigateFunction , useNavigate } from "react-router-dom" ;
5+ import { Path } from "../../constant" ;
66
77import Locale from "../../locales" ;
88
99import BotIcon from "../../icons/bot.svg" ;
10- import React , { FormEvent , useCallback , useState } from "react" ;
10+ import React , { FormEvent , useCallback , useState } from "react" ;
1111
1212import usePreventFormSubmit from "@/app/hooks/use-prevent-form" ;
13- import { useUserStore } from "@/app/store" ;
14- import { Input , showToast } from "@/app/components/ui-lib/ui-lib" ;
13+ import { useUserStore } from "@/app/store" ;
14+ import { Input , showToast } from "@/app/components/ui-lib/ui-lib" ;
1515import Locales from "@/app/locales" ;
1616import {
1717 apiUserLoginGet ,
@@ -20,9 +20,9 @@ import {
2020 apiUserRegister ,
2121 apiUserRegisterCode ,
2222} from "@/app/api" ;
23- import { serverStatus } from "@caw/types" ;
23+ import { serverStatus } from "@caw/types" ;
2424import useIntervalAsync from "@/app/hooks/use-interval-async" ;
25- import { Loading } from "@/app/components/loading" ;
25+ import { Loading } from "@/app/components/loading" ;
2626import Image from "next/image" ;
2727
2828const emailService = process . env . NEXT_PUBLIC_EMAIL_SERVICE ;
@@ -64,7 +64,7 @@ const PhoneLogin: React.FC = () => {
6464 Locales . User . PleaseInput ( `${ Locales . User . Phone } , ${ Locales . User . Code } ` ) ,
6565 ) ;
6666
67- const res = await apiUserRegister ( { phone : phone , verificationCode : code } ) ;
67+ const res = await apiUserRegister ( { phone : phone , verificationCode : code } ) ;
6868
6969 switch ( res . status ) {
7070 case serverStatus . success : {
@@ -193,7 +193,7 @@ const EmailLogin: React.FC = () => {
193193 </ div >
194194
195195 < div className = { styles [ "auth-actions" ] } >
196- < IconButton text = { Locale . Auth . Confirm } type = "primary" />
196+ < IconButton text = { Locale . Auth . Confirm } type = "primary" />
197197 </ div >
198198 </ div >
199199 ) ;
@@ -202,6 +202,7 @@ const EmailLogin: React.FC = () => {
202202const WeChatLogin : React . FC = ( ) => {
203203 const navigate = useNavigate ( ) ;
204204 const [ ticket , setTicket ] = useState ( "" ) ;
205+ const updateSessionToken = useUserStore ( ( state ) => state . updateSessionToken ) ;
205206
206207 useIntervalAsync (
207208 useCallback ( async ( ) => {
@@ -221,13 +222,12 @@ const WeChatLogin: React.FC = () => {
221222 return ;
222223 }
223224 }
224- } , [ ticket ] ) ,
225+ } , [ ticket , navigate , updateSessionToken ] ) ,
225226 3000 ,
226227 ) ;
227228
228- const updateSessionToken = useUserStore ( ( state ) => state . updateSessionToken ) ;
229229
230- if ( ! ticket ) return < Loading noLogo = { true } /> ;
230+ if ( ! ticket ) return < Loading noLogo = { true } /> ;
231231
232232 return (
233233 < div className = { styles [ "form-container" ] } >
@@ -249,15 +249,15 @@ export function AuthPage() {
249249 return (
250250 < div className = { styles [ "auth-page" ] } >
251251 < div className = { `no-dark ${ styles [ "auth-logo" ] } ` } >
252- < BotIcon />
252+ < BotIcon />
253253 </ div >
254254
255255 < div className = { styles [ "auth-title" ] } > { Locale . Auth . Title } </ div >
256256 < div className = { styles [ "auth-tips" ] } > { Locale . Auth . Tips } </ div >
257257
258258 < div className = { styles [ "auth-container" ] } >
259259 < div className = { styles [ "wechat-part" ] } >
260- < WeChatLogin />
260+ < WeChatLogin />
261261 </ div >
262262
263263 < div className = { styles [ "password-part" ] } >
@@ -281,7 +281,7 @@ export function AuthPage() {
281281 </ button >
282282 ) }
283283 </ div >
284- { tab === "phone" ? < PhoneLogin /> : < EmailLogin /> }
284+ { tab === "phone" ? < PhoneLogin /> : < EmailLogin /> }
285285 </ div >
286286 </ div >
287287 </ div >
0 commit comments