mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
47e41dea9b
commit
ebebf2a733
160 changed files with 4148 additions and 2001 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import { cx, css } from '@emotion/css'
|
||||
import { useEffect, useState, useMemo } from 'react'
|
||||
import qrCode from 'qrcode'
|
||||
import { useQuery } from 'react-query'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { checkLoginQrCodeStatus, fetchLoginQrCodeKey } from '@/web/api/auth'
|
||||
import toast from 'react-hot-toast'
|
||||
import { setCookies } from '@/web/utils/cookie'
|
||||
import uiStates from '@/web/states/uiStates'
|
||||
import reactQueryClient from '@/web/utils/reactQueryClient'
|
||||
import { UserApiNames } from '@/shared/api/User'
|
||||
|
||||
const QRCode = ({ className, text }: { className?: string; text: string }) => {
|
||||
const [image, setImage] = useState<string>('')
|
||||
|
|
@ -40,7 +42,7 @@ const LoginWithQRCode = () => {
|
|||
status: keyStatus,
|
||||
refetch: refetchKey,
|
||||
} = useQuery(
|
||||
'qrCodeKey',
|
||||
['qrCodeKey'],
|
||||
async () => {
|
||||
const result = await fetchLoginQrCodeKey()
|
||||
if (result.data.code !== 200) {
|
||||
|
|
@ -58,7 +60,7 @@ const LoginWithQRCode = () => {
|
|||
)
|
||||
|
||||
const { data: status } = useQuery(
|
||||
'qrCodeStatus',
|
||||
['qrCodeStatus'],
|
||||
async () => checkLoginQrCodeStatus({ key: key?.data?.unikey || '' }),
|
||||
{
|
||||
refetchInterval: 1000,
|
||||
|
|
@ -80,6 +82,7 @@ const LoginWithQRCode = () => {
|
|||
break
|
||||
}
|
||||
setCookies(status.cookie)
|
||||
reactQueryClient.refetchQueries([UserApiNames.FetchUserAccount])
|
||||
uiStates.showLoginPanel = false
|
||||
break
|
||||
}
|
||||
|
|
@ -97,7 +100,7 @@ const LoginWithQRCode = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<div className='text-center text-18 font-medium text-night-600'>
|
||||
<div className='text-center text-18 font-medium text-white/20'>
|
||||
Log in with NetEase QR
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue