Skip to content

Commit

Permalink
autopilot proposal (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: codeautopilot[bot] <131053011+codeautopilot[bot]@users.noreply.github.com>
  • Loading branch information
codeautopilot[bot] authored Nov 4, 2024
1 parent addbf11 commit a75bb8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 10 additions & 1 deletion docs/options/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ This will trigger if `auth.meta` is set to false and the user is already authent
```ts
@typeof AxiosRequestConfig & {
redirect?: RouteLocationRaw
keyUser?: string
autoLogin?: boolean
fetchUser?: boolean
staySignedIn?: boolean
Expand All @@ -297,6 +298,8 @@ Default register request data.

> If the `autoLogin` is enabled it will subsequently trigger a login call. All options available to the login method will also be available here.
> The `keyUser` option supports dot notation, allowing you to specify nested properties within the user object.
#### References

- [Requests Guide](/guide/requests)
Expand Down Expand Up @@ -328,6 +331,7 @@ Meaning does it expire after the browser is closed or not.
```ts
@typeof AxiosRequestConfig & {
redirect?: RouteLocationRaw
keyUser?: string
fetchUser?: boolean
staySignedIn?: boolean
remember?: boolean
Expand All @@ -344,6 +348,8 @@ Meaning does it expire after the browser is closed or not.

Default login request data.

> The `keyUser` option supports dot notation, allowing you to specify nested properties within the user object.
#### References

- [Requests Guide](/guide/requests)
Expand Down Expand Up @@ -408,6 +414,7 @@ Default oauth2 request data.
```ts
@typeof AxiosRequestConfig & {
redirect?: RouteLocationRaw
keyUser?: string
enabled?: boolean
cache?: boolean
enabledInBackground?: boolean
Expand All @@ -421,6 +428,8 @@ Default oauth2 request data.

Default fetch request data.

> The `keyUser` option supports dot notation, allowing you to specify nested properties within the user object.
#### References

- [Requests Guide](/guide/requests)
Expand Down Expand Up @@ -512,4 +521,4 @@ Default unimpersonate request data.
- [unimpersonate() Method](/methods/impersonating#unimpersonate)
- [redirect Option](/options/options-generate#redirect)
- [fetchUser Option](/options/options-generate#fetchuser)
- [makeRequest Option](/options/options-generate#makerequest)
- [makeRequest Option](/options/options-generate#makerequest)
8 changes: 4 additions & 4 deletions src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ export default class Auth {
const keyUser = fetchData.keyUser
setUserData(
this,
keyUser ? response.data[keyUser] : response.data,
keyUser ? getProperty(response.data, keyUser) : response.data,
data?.redirect
)

Expand Down Expand Up @@ -614,7 +614,7 @@ export default class Auth {
: this.options.fetchData.keyUser
setUserData(
this,
keyUser ? response.data[keyUser] : response.data,
keyUser ? getProperty(response.data, keyUser) : response.data,
registerData.redirect
)

Expand Down Expand Up @@ -646,7 +646,7 @@ export default class Auth {
: this.options.fetchData.keyUser
setUserData(
this,
keyUser ? response.data[keyUser] : response.data,
keyUser ? getProperty(response.data, keyUser) : response.data,
loginData.redirect
)
}
Expand Down Expand Up @@ -807,4 +807,4 @@ export default class Auth {
this.currentToken = this.options.tokenDefaultKey
}
}
}
}

0 comments on commit a75bb8b

Please sign in to comment.