diff --git a/src/GoTrueClient.ts b/src/GoTrueClient.ts index 54f32902..d832558a 100644 --- a/src/GoTrueClient.ts +++ b/src/GoTrueClient.ts @@ -721,14 +721,15 @@ export default class GoTrueClient { /** * Resends an existing signup confirmation email, email change email, SMS OTP or phone change OTP. */ - async resend(credentials: ResendParams): Promise { + async resend(params: ResendParams): Promise { try { await this._removeSession() const endpoint = `${this.url}/resend` - if ('email' in credentials) { - const { email, type, options } = credentials + if ('email' in params) { + const { email, type, options } = params const { error } = await _request(this.fetch, 'POST', endpoint, { headers: this.headers, + redirectTo: options?.redirectTo, body: { email, type, @@ -736,8 +737,8 @@ export default class GoTrueClient { }, }) return { data: { user: null, session: null }, error } - } else if ('phone' in credentials) { - const { phone, type, options } = credentials + } else if ('phone' in params) { + const { phone, type, options } = params const { data, error } = await _request(this.fetch, 'POST', endpoint, { headers: this.headers, body: { diff --git a/src/lib/types.ts b/src/lib/types.ts index a82e74da..64e4fd0a 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -551,6 +551,8 @@ export type ResendParams = type: Extract email: string options?: { + /** The redirect url embedded in the email link */ + redirectTo?: string /** Verification token received when the user completes the captcha on the site. */ captchaToken?: string }