abckit 0.0.6 → 0.0.8

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/dist/module.mjs CHANGED
@@ -11,7 +11,7 @@ const module$1 = defineNuxtModule({
11
11
  defaults: {
12
12
  sentry: false
13
13
  },
14
- moduleDependencies: {
14
+ moduleDependencies: (nuxt) => ({
15
15
  "@nuxtjs/tailwindcss": {},
16
16
  "notivue/nuxt": {},
17
17
  "@nuxt/icon": {},
@@ -20,8 +20,11 @@ const module$1 = defineNuxtModule({
20
20
  "@vueuse/nuxt": {},
21
21
  "@pinia/nuxt": {},
22
22
  "@vee-validate/nuxt": {},
23
- "nitro-graphql/nuxt": {}
24
- },
23
+ "nitro-graphql/nuxt": {},
24
+ "@sentry/nuxt/module": {
25
+ optional: nuxt.options.dev
26
+ }
27
+ }),
25
28
  async setup(options, nuxt) {
26
29
  const { resolve } = createResolver(import.meta.url);
27
30
  nuxt.options.runtimeConfig.public = defu(nuxt.options.runtimeConfig.public, {
@@ -5,28 +5,22 @@ import { computed, watch } from "vue";
5
5
  const authClient = createAuthClient({
6
6
  plugins: [adminClient()]
7
7
  });
8
- function setSentryUser(user) {
9
- const config = useRuntimeConfig();
10
- if (!config.public.abckit?.sentry) {
11
- return;
12
- }
13
- import("@sentry/nuxt").then((Sentry) => {
14
- Sentry.setUser(user);
15
- }).catch(() => {
16
- });
17
- }
18
8
  export function useAuth() {
19
9
  const session = authClient.useSession();
10
+ const config = useRuntimeConfig();
20
11
  const isLoading = computed(() => session.value.isPending);
21
12
  const isAuthenticated = computed(() => !!session.value.data?.user);
22
13
  const user = computed(() => session.value.data?.user || null);
23
- watch(user, (currentUser) => {
24
- if (currentUser) {
25
- setSentryUser({ id: currentUser.id });
26
- } else {
27
- setSentryUser(null);
28
- }
29
- }, { immediate: true });
14
+ if (config.public.abckit?.sentry) {
15
+ watch(user, async (currentUser) => {
16
+ const Sentry = await import("@sentry/nuxt");
17
+ if (currentUser) {
18
+ Sentry.setUser({ id: currentUser.id });
19
+ } else {
20
+ Sentry.setUser(null);
21
+ }
22
+ }, { immediate: true });
23
+ }
30
24
  function login(returnTo) {
31
25
  const query = returnTo ? `?return_to=${encodeURIComponent(returnTo)}` : "";
32
26
  navigateTo(`/auth/login${query}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "abckit",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {