Skip to content

Commit

Permalink
Amend import order in auth templates according to ESLint rules introd…
Browse files Browse the repository at this point in the history
…uced in v2.0 (#6059)

* Amend import order according to ESLint rules introduced in v2.0

* Lint fix import order and formatting of dbAuth templates
  • Loading branch information
Philzen authored Aug 9, 2022
1 parent eecfaa4 commit 06df623
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useEffect, useRef } from 'react'

import { useAuth } from '@redwoodjs/auth'
import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms'
import { navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'
import { Form, Label, TextField, Submit, FieldError } from '@redwoodjs/forms'

const ForgotPasswordPage = () => {
const { isAuthenticated, forgotPassword } = useAuth()
Expand All @@ -28,7 +29,9 @@ const ForgotPasswordPage = () => {
// The function `forgotPassword.handler` in api/src/functions/auth.js has
// been invoked, let the user know how to get the link to reset their
// password (sent in email, perhaps?)
toast.success('A link to reset your password was sent to ' + response.email)
toast.success(
'A link to reset your password was sent to ' + response.email
)
navigate(routes.login())
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Link, navigate, routes } from '@redwoodjs/router'
import { useRef } from 'react'
import { useEffect } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Label,
Expand All @@ -8,10 +10,9 @@ import {
Submit,
FieldError,
} from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'
import { useEffect } from 'react'

const LoginPage = () => {
const { isAuthenticated, logIn } = useAuth()
Expand Down Expand Up @@ -97,7 +98,10 @@ const LoginPage = () => {
/>

<div className="rw-forgot-link">
<Link to={routes.forgotPassword()} className="rw-forgot-link">
<Link
to={routes.forgotPassword()}
className="rw-forgot-link"
>
Forgot Password?
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Link, navigate, routes } from '@redwoodjs/router'
import { useRef, useState } from 'react'
import { useEffect } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Expand All @@ -9,9 +10,9 @@ import {
Submit,
FieldError,
} from '@redwoodjs/forms'
import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'
import { useEffect } from 'react'

const WELCOME_MESSAGE = 'Welcome back!'
const REDIRECT = routes.home()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { useEffect, useRef, useState } from 'react'

import { useAuth } from '@redwoodjs/auth'
import { navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'
import {
Form,
Label,
PasswordField,
Submit,
FieldError,
} from '@redwoodjs/forms'
import { navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

const ResetPasswordPage = ({ resetToken }) => {
const { isAuthenticated, reauthenticate, validateResetToken, resetPassword } = useAuth()
const { isAuthenticated, reauthenticate, validateResetToken, resetPassword } =
useAuth()
const [enabled, setEnabled] = useState(true)

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Link, navigate, routes } from '@redwoodjs/router'
import { useRef } from 'react'
import { useEffect } from 'react'

import { useAuth } from '@redwoodjs/auth'
import {
Form,
Label,
Expand All @@ -8,10 +10,9 @@ import {
FieldError,
Submit,
} from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'
import { useEffect } from 'react'

const SignupPage = () => {
const { isAuthenticated, signUp } = useAuth()
Expand Down Expand Up @@ -99,7 +100,9 @@ const SignupPage = () => {
<FieldError name="password" className="rw-field-error" />

<div className="rw-button-group">
<Submit className="rw-button rw-button-blue">Sign Up</Submit>
<Submit className="rw-button rw-button-blue">
Sign Up
</Submit>
</div>
</Form>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parseJWT } from '@redwoodjs/api'
import { AuthenticationError, ForbiddenError } from '@redwoodjs/graphql-server'

import { logger } from 'src/lib/logger'

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { AuthenticationError, ForbiddenError } from '@redwoodjs/graphql-server'
import { db } from './db'

import type { DbAuthSession } from '@redwoodjs/api'
import { AuthenticationError, ForbiddenError } from '@redwoodjs/graphql-server'

import { db } from './db'

/**
* The session object sent in as the first argument to getCurrentUser() will
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AuthenticationError, ForbiddenError } from '@redwoodjs/graphql-server'

import { db } from './db'

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { db } from 'src/lib/db'
import { DbAuthHandler } from '@redwoodjs/api'

import type { APIGatewayProxyEvent, Context } from 'aws-lambda'

import { DbAuthHandler } from '@redwoodjs/api'
import type { DbAuthHandlerOptions } from '@redwoodjs/api'

import { db } from 'src/lib/db'

export const handler = async (
event: APIGatewayProxyEvent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { db } from 'src/lib/db'
import { DbAuthHandler } from '@redwoodjs/api'

import { db } from 'src/lib/db'

export const handler = async (event, context) => {
const forgotPasswordOptions = {
// handler() is invoked after verifying that a user was found with the given
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AuthenticationError } from '@redwoodjs/graphql-server'
import admin from 'firebase-admin'

import { AuthenticationError } from '@redwoodjs/graphql-server'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const adminApp = admin.initializeApp({
projectId: process.env.FIREBASE_PROJECT_ID,
Expand Down

0 comments on commit 06df623

Please sign in to comment.