@witchcraft/nuxt-auth 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -583,7 +583,7 @@ The server will then bypass auth and create a session for the user.
|
|
|
583
583
|
|
|
584
584
|
## Testing the Server APIs directly with Mock Users
|
|
585
585
|
|
|
586
|
-
This is a bit more complicated because the ecosystem is not very mature here. The nuxt test utils (really unjs/ofetch) do not expose a $fetch that can use cookies so we have to create it with the help of [`fetch-cookies`](https://www.npmjs.com/package/fetch-cookie):
|
|
586
|
+
This is a bit more complicated because the ecosystem is not very mature here. The nuxt test utils (really unjs/ofetch) do not expose a $fetch that can use cookies so we have to create it with the help of [`fetch-cookies`](https://www.npmjs.com/package/fetch-cookie). ofetch is stateless by design and will not persist cookies between requests ([unjs/ofetch#382](https://github.com/unjs/ofetch/issues/382), [unjs/ofetch#435](https://github.com/unjs/ofetch/issues/435)):
|
|
587
587
|
|
|
588
588
|
Create a utility function somewhere:
|
|
589
589
|
|
package/dist/module.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<WAuth
|
|
3
3
|
:class="$attrs?.class"
|
|
4
4
|
:providers="enabledProviders"
|
|
5
|
-
:provider-styles="
|
|
5
|
+
:provider-styles="fullProviderStyles"
|
|
6
6
|
@login="onLogin"
|
|
7
7
|
>
|
|
8
8
|
<template #extra="slotProps">
|
|
@@ -20,9 +20,12 @@ export default {};
|
|
|
20
20
|
|
|
21
21
|
<script setup>
|
|
22
22
|
import WAuth from "@witchcraft/ui/components/WAuth";
|
|
23
|
+
import defu from "defu";
|
|
24
|
+
import { pick } from "@alanscodelog/utils/pick";
|
|
23
25
|
import { useRuntimeConfig } from "#app";
|
|
24
|
-
import { useAttrs } from "#imports";
|
|
26
|
+
import { computed, useAttrs } from "#imports";
|
|
25
27
|
import { useAuth } from "../composables/useAuth.js";
|
|
28
|
+
import { providerStyles as baseProviderStyles } from "../core/providerStyles.js";
|
|
26
29
|
if (import.meta.dev) {
|
|
27
30
|
console.warn("[nuxt-auth] <LoginProviderButtons> is deprecated and will be removed in a future version.");
|
|
28
31
|
}
|
|
@@ -39,6 +42,10 @@ const props = defineProps({
|
|
|
39
42
|
loginOptions: { type: null, required: false, default: () => ({}) }
|
|
40
43
|
});
|
|
41
44
|
const { login } = useAuth(props.useAuthOptions);
|
|
45
|
+
const fullProviderStyles = computed(() => defu(
|
|
46
|
+
props.providerStyles,
|
|
47
|
+
pick(baseProviderStyles, enabledProviders)
|
|
48
|
+
));
|
|
42
49
|
function onLogin(provider) {
|
|
43
50
|
login(provider, props.loginOptions);
|
|
44
51
|
}
|