Skip to content

Commit ea46f05

Browse files
committed
v0breaking: renamed createExternalAuthHandler => createExternalAuthLoginHandler
This makes it clearer it can only handle logins
1 parent d27e45e commit ea46f05

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ In some cases you may want to customize this behavior, such as when calling this
187187

188188
This can be customized with the `handleActions` option on the `useAuth` composable.
189189

190-
There is also a `createExternalAuthHandler` helper and related utils, see [External Auth Handlers](#external-auth-handlers).
190+
There is also a `createExternalAuthLoginHandler` helper and related utils, see [External Auth Handlers](#external-auth-handlers).
191191

192192
### Changing Routes
193193

@@ -411,7 +411,7 @@ definePageMeta({
411411
412412
```
413413

414-
Then in the login page, we can use the `createExternalAuthHandler` to intercept the action of the `LoginProviderButtons` only when the user is on electron.
414+
Then in the login page, we can use the `createExternalAuthLoginHandler` to intercept the action of the `LoginProviderButtons` only when the user is on electron.
415415

416416

417417
```vue [pages/auth/login.vue]
@@ -425,14 +425,14 @@ import { useRuntimeConfig } from "#app"
425425
const rc = useRuntimeConfig()
426426
427427
const handleActions: ActionHandler = (action, url) =>
428-
createExternalAuthHandler(
428+
createExternalAuthLoginHandler(
429429
"electron", // for the query param
430430
isElectron, // platform check
431431
publicServerUrl, // you must define this somehow
432432
window?.electron?.api.open,
433433
"auth/code", // the default
434434
)(action, url)
435-
|| createExternalAuthHandler(...) // they can be chained
435+
|| createExternalAuthLoginHandler(...) // they can be chained
436436
437437
</script>
438438
```

src/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export default defineNuxtModule<ModuleOptions>({
299299
"runtime/utils/getAuthApiRoute",
300300
"runtime/core/providers/google",
301301
"runtime/core/providers/github",
302-
"runtime/utils/createExternalAuthHandler"
302+
"runtime/utils/createExternalAuthLoginHandler"
303303
]) {
304304
nuxt.options.build.transpile.push(resolve(file))
305305
}

src/runtime/utils/createExternalAuthHandler.ts renamed to src/runtime/utils/createExternalAuthLoginHandler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { navigateTo, useRuntimeConfig } from "#imports"
22

33
/**
4-
* Creates an external (e.g. desktop) auth handler.
4+
* Creates an external (e.g. desktop) auth login handler. A logout one doesn't exist as that is very platform dependant.
55
*/
6-
export function createExternalAuthHandler(
6+
export function createExternalAuthLoginHandler(
77
/**
88
* The name of the platform.
99
*
@@ -43,11 +43,11 @@ export function createExternalAuthHandler(
4343
if (!isExternal()) return false
4444

4545
if (deeplinkCallbackPath === undefined) {
46-
throw new Error("createExternalAuthHandler: deeplinkCallbackPath cannot be undefined. See docs for more info.")
46+
throw new Error("createExternalAuthLoginHandler: deeplinkCallbackPath cannot be undefined. See docs for more info.")
4747
}
4848

49-
if (!serverUrl) throw new Error("createExternalAuthHandler: serverUrl cannot be undefined when isExternal returns true. See docs for more info.")
50-
if (!open) throw new Error("createExternalAuthHandler: open cannot be undefined when isExternal returns true. See docs for more info.")
49+
if (!serverUrl) throw new Error("createExternalAuthLoginHandler: serverUrl cannot be undefined when isExternal returns true. See docs for more info.")
50+
if (!open) throw new Error("createExternalAuthLoginHandler: open cannot be undefined when isExternal returns true. See docs for more info.")
5151

5252
let origin = typeof serverUrl === "function" ? serverUrl() : serverUrl
5353
if (origin instanceof Promise) {

0 commit comments

Comments
 (0)