feat: complete email binding and pending oauth verification flows
This commit is contained in:
@@ -449,6 +449,16 @@ export async function sendVerifyCode(
|
||||
return data
|
||||
}
|
||||
|
||||
export async function sendPendingOAuthVerifyCode(
|
||||
request: SendVerifyCodeRequest
|
||||
): Promise<SendVerifyCodeResponse> {
|
||||
const { data } = await apiClient.post<SendVerifyCodeResponse>(
|
||||
'/auth/oauth/pending/send-verify-code',
|
||||
request
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate promo code response
|
||||
*/
|
||||
@@ -638,6 +648,7 @@ export const authAPI = {
|
||||
clearAuthToken,
|
||||
getPublicSettings,
|
||||
sendVerifyCode,
|
||||
sendPendingOAuthVerifyCode,
|
||||
validatePromoCode,
|
||||
validateInvitationCode,
|
||||
forgotPassword,
|
||||
|
||||
@@ -89,6 +89,19 @@ export async function toggleNotifyEmail(email: string, disabled: boolean): Promi
|
||||
return data
|
||||
}
|
||||
|
||||
export async function sendEmailBindingCode(email: string): Promise<void> {
|
||||
await apiClient.post('/user/account-bindings/email/send-code', { email })
|
||||
}
|
||||
|
||||
export async function bindEmailIdentity(payload: {
|
||||
email: string
|
||||
verify_code: string
|
||||
password: string
|
||||
}): Promise<User> {
|
||||
const { data } = await apiClient.post<User>('/user/account-bindings/email', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export type BindableOAuthProvider = Exclude<UserAuthProvider, 'email'>
|
||||
|
||||
interface BuildOAuthBindingStartURLOptions {
|
||||
@@ -158,6 +171,8 @@ export const userAPI = {
|
||||
verifyNotifyEmail,
|
||||
removeNotifyEmail,
|
||||
toggleNotifyEmail,
|
||||
sendEmailBindingCode,
|
||||
bindEmailIdentity,
|
||||
buildOAuthBindingStartURL,
|
||||
startOAuthBinding
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user