From dd5c129fb808ebce3b8ba14a1be96619b74472b9 Mon Sep 17 00:00:00 2001 From: tomiir Date: Tue, 2 Jan 2024 09:27:08 -0600 Subject: [PATCH] chore: remove zod usage in scaffold. rely on upstream validation --- .../src/partials/w3m-email-login-widget/index.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/packages/scaffold/src/partials/w3m-email-login-widget/index.ts b/packages/scaffold/src/partials/w3m-email-login-widget/index.ts index cea45c6f81..9245a70290 100644 --- a/packages/scaffold/src/partials/w3m-email-login-widget/index.ts +++ b/packages/scaffold/src/partials/w3m-email-login-widget/index.ts @@ -6,7 +6,6 @@ import { ref, createRef } from 'lit/directives/ref.js' import type { Ref } from 'lit/directives/ref.js' import styles from './styles.js' import { SnackController, RouterController } from '@web3modal/core' -import { z } from 'zod' @customElement('w3m-email-login-widget') export class W3mEmailLoginWidget extends LitElement { @@ -97,12 +96,6 @@ export class W3mEmailLoginWidget extends LitElement { if (this.loading) { return } - const { success: isEmailValid } = z.string().email().safeParse(this.email) - if (!isEmailValid) { - this.error = 'Invalid email. Try again' - - return - } this.loading = true event.preventDefault() const emailConnector = ConnectorController.getEmailConnector() @@ -116,8 +109,12 @@ export class W3mEmailLoginWidget extends LitElement { } else if (action === 'VERIFY_DEVICE') { RouterController.push('EmailVerifyDevice', { email: this.email }) } - } catch (error) { - SnackController.showError(error) + } catch (error: any) { + if (error?.validation === 'email') { + this.error = 'Invalid email. Try again' + } else { + SnackController.showError(error) + } } finally { this.loading = false }