Skip to content

Commit

Permalink
docs: update useAuth import in Supabase how-to (redwoodjs#10679)
Browse files Browse the repository at this point in the history
Update import { useAuth } from '@redwoodjs/auth' to 'src/auth' in the
Supabase authentication how-to
  • Loading branch information
jcianca committed May 23, 2024
1 parent 902d006 commit c1c91de
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/docs/how-to/supabase-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Let's import `useAuth` and destructure `client` from it in our component:

```jsx {2,5} title="web/src/pages/SignupPage/SignupPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SignupPage = () => {
const { client } = useAuth()
Expand All @@ -199,7 +199,7 @@ And now we'll attempt to create a new user in the `onSubmit` function with [`cli

```jsx {8-16} title="web/src/pages/SignupPage/SignupPage.[js/tsx]"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SignupPage = () => {
const { client } = useAuth()
Expand Down Expand Up @@ -236,7 +236,7 @@ Let's display errors to the user if there are any. To do this, we'll set up `Rea

```jsx {6,9,16,18,26} title="web/src/pages/SignupPage/SignupPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SignupPage = () => {
const { client } = useAuth()
Expand Down Expand Up @@ -289,7 +289,7 @@ Let's import `routes` and `navigate` from [Redwood Router](../router.md#navigate
```jsx {3,16} title="web/src/pages/SignupPage/SignupPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'
import { routes, navigate } from '@redwoodjs/router'

const SignupPage = () => {
Expand Down Expand Up @@ -362,11 +362,11 @@ const SigninPage = () => {
export default SigninPage
```
Then we'll need to import `useAuth` from `@redwoodjs/auth` and destructure `logIn` so that we can use it in our `onSubmit` function:
Then we'll need to import `useAuth` from `src/auth` and destructure `logIn` so that we can use it in our `onSubmit` function:
```jsx {2,5} title="web/src/pages/SigninPage/SigninPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SigninPage = () => {
const { logIn } = useAuth()
Expand Down Expand Up @@ -397,7 +397,7 @@ Now we'll add `logIn` to our `onSubmit` function. This time we'll be passing an
```jsx {10-15} title="web/src/pages/SigninPage/SigninPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SigninPage = () => {
const { logIn } = useAuth()
Expand Down Expand Up @@ -435,7 +435,7 @@ In our `SigninPage`, import `navigate` and `routes` from [`@redwoodjs/router`](.
```jsx {10-16} title="web/src/pages/SigninPage/SigninPage.js"
import { Form, TextField, PasswordField, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'
import { navigate, routes } from '@redwoodjs/router'

const SigninPage = () => {
Expand Down Expand Up @@ -495,10 +495,10 @@ const SignoutBtn = () => {
export default SignoutBtn
```
Now let's import `useAuth` from `@redwoodjs/auth`. We'll destructure its `logOut` method and invoke it in `onClick`:
Now let's import `useAuth` from `src/auth`. We'll destructure its `logOut` method and invoke it in `onClick`:
```jsx {1,4,7} title="web/src/components/SignoutBtn/SignoutBtn.[js/tsx]"
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const SignoutBtn = () => {
const { logOut } = useAuth()
Expand All @@ -515,7 +515,7 @@ export default SignoutBtn
This works as is, but because the user may be in a restricted part of your app when they sign out, we should make sure to navigate them away from this page:
```jsx {2,8-9} title="web/src/components/SignoutBtn/SignoutBtn.[js/tsx]"
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'
import { navigate, routes } from '@redwoodjs/router'

const SignoutBtn = () => {
Expand Down Expand Up @@ -552,7 +552,7 @@ We'll also import [`useAuth`](../authentication.md#api) since we'll need to subs
```jsx title="web/src/components/Navigation/Navigation.js"
import { Link, routes } from '@redwoodjs/router'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const Navigation = () => {
return <nav></nav>
Expand All @@ -565,7 +565,7 @@ Let's destructure `isAuthenticated` from the `useAuth` hook and use it in some c
```jsx {5,8-12} title="web/src/components/Navigation/Navigation.js"
import { Link, routes } from '@redwoodjs/router'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'

const Navigation = () => {
const { isAuthenticated } = useAuth()
Expand All @@ -589,7 +589,7 @@ Now let's import our sign out button and add it, as well as sign in and sign up
```jsx {3,9-16} title="web/src/components/Navigation/Navigation.[js/tsx]"
import { Link, routes } from '@redwoodjs/router'
import { useAuth } from '@redwoodjs/auth'
import { useAuth } from 'src/auth'
import SignoutBtn from 'src/components/SignoutBtn/SignoutBtn'

const Navigation = () => {
Expand Down

0 comments on commit c1c91de

Please sign in to comment.