✨ feat(auth): Add type parameter to SendCode and update related API typings
This commit is contained in:
parent
e5455aa1dc
commit
4198871eef
@ -37,10 +37,11 @@ export default function SendCode({ type, params }: SendCodeProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPhoneCode = async () => {
|
const getPhoneCode = async () => {
|
||||||
if (params.telephone && params.telephone_area_code) {
|
if (params.telephone && params.telephone_area_code && params.type) {
|
||||||
await sendSmsCode({
|
await sendSmsCode({
|
||||||
telephone: params.telephone,
|
telephone: params.telephone,
|
||||||
telephone_area_code: params.telephone_area_code,
|
telephone_area_code: params.telephone_area_code,
|
||||||
|
type: params.type,
|
||||||
});
|
});
|
||||||
setTargetDate(Date.now() + 60000);
|
setTargetDate(Date.now() + 60000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as announcement from './announcement';
|
import * as announcement from './announcement';
|
||||||
|
|||||||
1
apps/admin/services/admin/typings.d.ts
vendored
1
apps/admin/services/admin/typings.d.ts
vendored
@ -1401,6 +1401,7 @@ declare namespace API {
|
|||||||
auth_type: string;
|
auth_type: string;
|
||||||
auth_identifier: string;
|
auth_identifier: string;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
|
area_code?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserBalanceLog = {
|
type UserBalanceLog = {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
2
apps/admin/services/common/typings.d.ts
vendored
2
apps/admin/services/common/typings.d.ts
vendored
@ -348,6 +348,7 @@ declare namespace API {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type SendSmsCodeRequest = {
|
type SendSmsCodeRequest = {
|
||||||
|
type: number;
|
||||||
telephone: string;
|
telephone: string;
|
||||||
telephone_area_code: string;
|
telephone_area_code: string;
|
||||||
};
|
};
|
||||||
@ -594,6 +595,7 @@ declare namespace API {
|
|||||||
auth_type: string;
|
auth_type: string;
|
||||||
auth_identifier: string;
|
auth_identifier: string;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
|
area_code?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserBalanceLog = {
|
type UserBalanceLog = {
|
||||||
|
|||||||
@ -123,7 +123,13 @@ function MobileBindDialog({
|
|||||||
<FormControl>
|
<FormControl>
|
||||||
<div className='flex gap-2'>
|
<div className='flex gap-2'>
|
||||||
<Input placeholder='Enter code...' type='text' {...field} />
|
<Input placeholder='Enter code...' type='text' {...field} />
|
||||||
<SendCode type='phone' params={form.getValues()} />
|
<SendCode
|
||||||
|
type='phone'
|
||||||
|
params={{
|
||||||
|
...form.getValues(),
|
||||||
|
type: 2,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,15 @@ export default function LoginForm({
|
|||||||
type={mode === 'code' ? 'text' : 'password'}
|
type={mode === 'code' ? 'text' : 'password'}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
{mode === 'code' && <SendCode type='phone' params={form.getValues()} />}
|
{mode === 'code' && (
|
||||||
|
<SendCode
|
||||||
|
type='phone'
|
||||||
|
params={{
|
||||||
|
...form.getValues(),
|
||||||
|
type: 2,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div className='!mt-0 text-right'>
|
<div className='!mt-0 text-right'>
|
||||||
|
|||||||
@ -153,7 +153,14 @@ export default function RegisterForm({
|
|||||||
{...field}
|
{...field}
|
||||||
value={field.value as string}
|
value={field.value as string}
|
||||||
/>
|
/>
|
||||||
<SendCode type='phone' params={form.getValues()} />
|
|
||||||
|
<SendCode
|
||||||
|
type='phone'
|
||||||
|
params={{
|
||||||
|
...form.getValues(),
|
||||||
|
type: 1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@ -104,7 +104,13 @@ export default function ResetForm({
|
|||||||
{...field}
|
{...field}
|
||||||
value={field.value as string}
|
value={field.value as string}
|
||||||
/>
|
/>
|
||||||
<SendCode type='phone' params={form.getValues()} />
|
<SendCode
|
||||||
|
type='phone'
|
||||||
|
params={{
|
||||||
|
...form.getValues(),
|
||||||
|
type: 2,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|||||||
@ -37,10 +37,11 @@ export default function SendCode({ type, params }: SendCodeProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getPhoneCode = async () => {
|
const getPhoneCode = async () => {
|
||||||
if (params.telephone && params.telephone_area_code) {
|
if (params.telephone && params.telephone_area_code && params.type) {
|
||||||
await sendSmsCode({
|
await sendSmsCode({
|
||||||
telephone: params.telephone,
|
telephone: params.telephone,
|
||||||
telephone_area_code: params.telephone_area_code,
|
telephone_area_code: params.telephone_area_code,
|
||||||
|
type: params.type,
|
||||||
});
|
});
|
||||||
setTargetDate(Date.now() + 60000);
|
setTargetDate(Date.now() + 60000);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
// API 更新时间:
|
// API 更新时间:
|
||||||
// API 唯一标识:
|
// API 唯一标识:
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
|
|||||||
2
apps/user/services/common/typings.d.ts
vendored
2
apps/user/services/common/typings.d.ts
vendored
@ -348,6 +348,7 @@ declare namespace API {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type SendSmsCodeRequest = {
|
type SendSmsCodeRequest = {
|
||||||
|
type: number;
|
||||||
telephone: string;
|
telephone: string;
|
||||||
telephone_area_code: string;
|
telephone_area_code: string;
|
||||||
};
|
};
|
||||||
@ -594,6 +595,7 @@ declare namespace API {
|
|||||||
auth_type: string;
|
auth_type: string;
|
||||||
auth_identifier: string;
|
auth_identifier: string;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
|
area_code?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserBalanceLog = {
|
type UserBalanceLog = {
|
||||||
|
|||||||
26
apps/user/services/user/typings.d.ts
vendored
26
apps/user/services/user/typings.d.ts
vendored
@ -70,6 +70,16 @@ declare namespace API {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type BindEmailRequest = {
|
||||||
|
email: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type BindMobileRequest = {
|
||||||
|
area_code: string;
|
||||||
|
mobile: string;
|
||||||
|
code: string;
|
||||||
|
};
|
||||||
|
|
||||||
type BindOAuthCallbackRequest = {
|
type BindOAuthCallbackRequest = {
|
||||||
method: string;
|
method: string;
|
||||||
callback: Record<string, any>;
|
callback: Record<string, any>;
|
||||||
@ -89,6 +99,16 @@ declare namespace API {
|
|||||||
expired_at: number;
|
expired_at: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ChangebindEmailRequest = {
|
||||||
|
email: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ChangebindMobileRequest = {
|
||||||
|
area_code: string;
|
||||||
|
mobile: string;
|
||||||
|
code: string;
|
||||||
|
};
|
||||||
|
|
||||||
type CheckoutOrderRequest = {
|
type CheckoutOrderRequest = {
|
||||||
orderNo: string;
|
orderNo: string;
|
||||||
};
|
};
|
||||||
@ -783,6 +803,7 @@ declare namespace API {
|
|||||||
auth_type: string;
|
auth_type: string;
|
||||||
auth_identifier: string;
|
auth_identifier: string;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
|
area_code?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UserBalanceLog = {
|
type UserBalanceLog = {
|
||||||
@ -851,6 +872,11 @@ declare namespace API {
|
|||||||
enable_reset_password_verify: boolean;
|
enable_reset_password_verify: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type VerifyEmailRequest = {
|
||||||
|
email: string;
|
||||||
|
code: string;
|
||||||
|
};
|
||||||
|
|
||||||
type Vless = {
|
type Vless = {
|
||||||
port: number;
|
port: number;
|
||||||
flow: string;
|
flow: string;
|
||||||
|
|||||||
@ -42,6 +42,30 @@ export async function queryUserBalanceLog(options?: { [key: string]: any }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Bind Email POST /v1/public/user/bind_email */
|
||||||
|
export async function bindEmail(body: API.BindEmailRequest, options?: { [key: string]: any }) {
|
||||||
|
return request<API.Response & { data?: any }>('/v1/public/user/bind_email', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bind Mobile POST /v1/public/user/bind_mobile */
|
||||||
|
export async function bindMobile(body: API.BindMobileRequest, options?: { [key: string]: any }) {
|
||||||
|
return request<API.Response & { data?: any }>('/v1/public/user/bind_mobile', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Bind OAuth POST /v1/public/user/bind_oauth */
|
/** Bind OAuth POST /v1/public/user/bind_oauth */
|
||||||
export async function bindOAuth(body: API.BindOAuthRequest, options?: { [key: string]: any }) {
|
export async function bindOAuth(body: API.BindOAuthRequest, options?: { [key: string]: any }) {
|
||||||
return request<API.Response & { data?: API.BindOAuthResponse }>('/v1/public/user/bind_oauth', {
|
return request<API.Response & { data?: API.BindOAuthResponse }>('/v1/public/user/bind_oauth', {
|
||||||
@ -80,6 +104,36 @@ export async function bindTelegram(options?: { [key: string]: any }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Change Bind Email POST /v1/public/user/change_bind_email */
|
||||||
|
export async function changebindEmail(
|
||||||
|
body: API.ChangebindEmailRequest,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<API.Response & { data?: any }>('/v1/public/user/change_bind_email', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Change Bind Mobile POST /v1/public/user/change_bind_mobile */
|
||||||
|
export async function changebindMobile(
|
||||||
|
body: API.ChangebindMobileRequest,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<API.Response & { data?: any }>('/v1/public/user/change_bind_mobile', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Query User Commission Log GET /v1/public/user/commission_log */
|
/** Query User Commission Log GET /v1/public/user/commission_log */
|
||||||
export async function queryUserCommissionLog(
|
export async function queryUserCommissionLog(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
@ -255,3 +309,15 @@ export async function preUnsubscribe(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Verify Email POST /v1/public/user/verify_email */
|
||||||
|
export async function verifyEmail(body: API.VerifyEmailRequest, options?: { [key: string]: any }) {
|
||||||
|
return request<API.Response & { data?: any }>('/v1/public/user/verify_email', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user