Skip to content

Commit 9a32c7d

Browse files
authored
fix(docs): $storage lead to nowhere (#1444)
$storage lead to nowhere. Issue #1443
1 parent edffebd commit 9a32c7d

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

docs/content/en/api/auth.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ this.$auth.loggedIn
3939
this.$store.state.auth.loggedIn
4040
```
4141

42-
Under the hood, auth uses attached [`$storage`](./storage.md) instance to provide this states.
43-
42+
Under the hood, auth uses attached [`$storage`](./storage) instance to provide this states.
4443

4544
## methods
4645

@@ -51,10 +50,20 @@ Under the hood, auth uses attached [`$storage`](./storage.md) instance to provid
5150
Set current strategy to `strategyName` and attempt login. Usage varies by current strategy.
5251

5352
```js
54-
this.$auth.loginWith('local', { data: { /* data to post to server */ } })
53+
this.$auth
54+
.loginWith('local', {
55+
data: {
56+
/* data to post to server */
57+
}
58+
})
5559
.then(() => this.$toast.success('Logged In!'))
56-
57-
this.$auth.loginWith('google', { params: { /* additional authentication parameters */ } })
60+
61+
this.$auth
62+
.loginWith('google', {
63+
params: {
64+
/* additional authentication parameters */
65+
}
66+
})
5867
.then(() => this.$toast.success('Logged In!'))
5968
```
6069

@@ -67,8 +76,7 @@ Login using active strategy. Usage varies by current strategy.
6776
> **TIP:** Using `loginWith` is recommended instead of this function!
6877
6978
```js
70-
this.$auth.login(/* .... */)
71-
.then(() => this.$toast.success('Logged In!'))
79+
this.$auth.login(/* .... */).then(() => this.$toast.success('Logged In!'))
7280
```
7381

7482
### `setUser(user)`
@@ -90,7 +98,8 @@ Set the auth token and optionally the refresh token, then it will fetch the user
9098
> **TIP:** This function can properly set the user after registration
9199
92100
```js
93-
this.$auth.setUserToken(token, refreshToken)
101+
this.$auth
102+
.setUserToken(token, refreshToken)
94103
.then(() => this.$toast.success('User set!'))
95104
```
96105

@@ -125,7 +134,7 @@ this.$auth.hasScope('admin')
125134

126135
### `refreshTokens()`
127136

128-
Refreshes tokens if *refresh token* is available and not expired. This only works when logged in.
137+
Refreshes tokens if _refresh token_ is available and not expired. This only works when logged in.
129138

130139
```js
131140
// Refresh tokens
@@ -139,7 +148,7 @@ this.$auth.refreshTokens()
139148
Listen for auth errors: (`plugins/auth.js`)
140149

141150
```js
142-
export default function({ $auth }) {
151+
export default function ({ $auth }) {
143152
$auth.onError((error, name, endpoint) => {
144153
console.error(name, error)
145154
})
@@ -148,10 +157,10 @@ export default function({ $auth }) {
148157

149158
### `onRedirect(handler)`
150159

151-
Pre-process URLs before redirect: (`plugins/auth.js`)
160+
Pre-process URLs before redirect: (`plugins/auth.js`)
152161

153-
```js
154-
export default function({ $auth }) {
162+
```js
163+
export default function ({ $auth }) {
155164
$auth.onRedirect((to, from) => {
156165
console.error(to)
157166
// you can optionally change `to` by returning a new value

0 commit comments

Comments
 (0)