Skip to content

Commit

Permalink
chore: remove zod usage in scaffold. rely on upstream validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiir committed Jan 2, 2024
1 parent 9170833 commit dd5c129
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/scaffold/src/partials/w3m-email-login-widget/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand All @@ -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) {

Check failure on line 112 in packages/scaffold/src/partials/w3m-email-login-widget/index.ts

View workflow job for this annotation

GitHub Actions / code_style (lint)

Unexpected any. Specify a different type
if (error?.validation === 'email') {
this.error = 'Invalid email. Try again'
} else {
SnackController.showError(error)
}
} finally {
this.loading = false
}
Expand Down

0 comments on commit dd5c129

Please sign in to comment.