✨ feat(auth): Add type parameter to SendCode and update related API typings
This commit is contained in:
@@ -123,7 +123,13 @@ function MobileBindDialog({
|
||||
<FormControl>
|
||||
<div className='flex gap-2'>
|
||||
<Input placeholder='Enter code...' type='text' {...field} />
|
||||
<SendCode type='phone' params={form.getValues()} />
|
||||
<SendCode
|
||||
type='phone'
|
||||
params={{
|
||||
...form.getValues(),
|
||||
type: 2,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
|
||||
|
||||
@@ -103,7 +103,15 @@ export default function LoginForm({
|
||||
type={mode === 'code' ? 'text' : 'password'}
|
||||
{...field}
|
||||
/>
|
||||
{mode === 'code' && <SendCode type='phone' params={form.getValues()} />}
|
||||
{mode === 'code' && (
|
||||
<SendCode
|
||||
type='phone'
|
||||
params={{
|
||||
...form.getValues(),
|
||||
type: 2,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</FormControl>
|
||||
<div className='!mt-0 text-right'>
|
||||
|
||||
@@ -153,7 +153,14 @@ export default function RegisterForm({
|
||||
{...field}
|
||||
value={field.value as string}
|
||||
/>
|
||||
<SendCode type='phone' params={form.getValues()} />
|
||||
|
||||
<SendCode
|
||||
type='phone'
|
||||
params={{
|
||||
...form.getValues(),
|
||||
type: 1,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -104,7 +104,13 @@ export default function ResetForm({
|
||||
{...field}
|
||||
value={field.value as string}
|
||||
/>
|
||||
<SendCode type='phone' params={form.getValues()} />
|
||||
<SendCode
|
||||
type='phone'
|
||||
params={{
|
||||
...form.getValues(),
|
||||
type: 2,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -37,10 +37,11 @@ export default function SendCode({ type, params }: SendCodeProps) {
|
||||
};
|
||||
|
||||
const getPhoneCode = async () => {
|
||||
if (params.telephone && params.telephone_area_code) {
|
||||
if (params.telephone && params.telephone_area_code && params.type) {
|
||||
await sendSmsCode({
|
||||
telephone: params.telephone,
|
||||
telephone_area_code: params.telephone_area_code,
|
||||
type: params.type,
|
||||
});
|
||||
setTargetDate(Date.now() + 60000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user