Skip to content

Commit

Permalink
feat:回退send-login
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoyafng committed Nov 9, 2024
1 parent 62c06a6 commit 09078b4
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions packages/guard-core-v4/src/SendCode/SendCodeByPhone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { SendCode } from './index'

import { parsePhone } from '../_utils/hooks'

import { useGuardAppId, useGuardEvents } from '../_utils/context'
import { useGuardEvents } from '../_utils/context'

import { useGuardHttp } from '../_utils/guardHttp'

Expand Down Expand Up @@ -49,7 +49,6 @@ export const SendCodeByPhone: React.FC<SendCodeByPhoneProps> = props => {
const { t } = useTranslation()

const authClient = useGuardAuthClient()
const appId = useGuardAppId()

const events = useGuardEvents()
const { post } = useGuardHttp()
Expand All @@ -67,29 +66,11 @@ export const SendCodeByPhone: React.FC<SendCodeByPhoneProps> = props => {
* post 方法:packages/react-components/components/_utils/http.ts
* 响应拦截:packages/react-components/components/_utils/responseManagement/index.ts
*/
// 根据 scene 区分接口请求
let url, pAppId

switch (scene) {
case SceneType.SCENE_TYPE_LOGIN:
url = '/api/v2/sms/send-login'
pAppId = appId
break
case SceneType.SCENE_TYPE_REGISTER:
url = '/api/v2/sms/send-register'
pAppId = appId
break
default:
url = '/api/v2/sms/send'
break
}

const data = await post(url, {
const data = await post('/api/v2/sms/send', {
phone,
phoneCountryCode: countryCode,
scene,
captchaCode,
appId: pAppId
captchaCode
})
const { code, statusCode, message: msg } = data
// 200 表示请求成功,不报错
Expand Down

0 comments on commit 09078b4

Please sign in to comment.