nextauthz 1.0.6 → 1.0.7

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/index.js CHANGED
@@ -1791,7 +1791,7 @@ var useAuthStore = (0, import_zustand.create)((set) => ({
1791
1791
  var import_jsx_runtime = __toESM(require_jsx_runtime());
1792
1792
  function createAuthContext(options) {
1793
1793
  const AuthContext = (0, import_react.createContext)(null);
1794
- const AuthProvider2 = ({ children }) => {
1794
+ const AuthProvider = ({ children }) => {
1795
1795
  const storageType = options?.storage || "cookie";
1796
1796
  (0, import_react.useEffect)(() => {
1797
1797
  (0, import_react_token_manager.configureTokenManager)({ storage: storageType });
@@ -1855,7 +1855,7 @@ function createAuthContext(options) {
1855
1855
  if (!ctx) throw new Error("useAuth must be used inside AuthProvider");
1856
1856
  return ctx;
1857
1857
  };
1858
- return { AuthProvider: AuthProvider2, useAuth: useAuth2 };
1858
+ return { AuthProvider, useAuth: useAuth2 };
1859
1859
  }
1860
1860
 
1861
1861
  // src/AuthGuard.tsx
@@ -1917,10 +1917,11 @@ var import_react3 = __toESM(require_react());
1917
1917
  var import_navigation2 = require("next/navigation");
1918
1918
 
1919
1919
  // src/myAuth.ts
1920
- var { AuthProvider, useAuth } = createAppAuth();
1920
+ var auth = createAppAuth();
1921
1921
 
1922
1922
  // src/RoleGuard.tsx
1923
1923
  var import_jsx_runtime3 = __toESM(require_jsx_runtime());
1924
+ var { useAuth } = auth;
1924
1925
  var RoleGuard = ({
1925
1926
  children,
1926
1927
  allowedRoles,
package/dist/index.mjs CHANGED
@@ -1775,7 +1775,7 @@ var useAuthStore = create((set) => ({
1775
1775
  var import_jsx_runtime = __toESM(require_jsx_runtime());
1776
1776
  function createAuthContext(options) {
1777
1777
  const AuthContext = (0, import_react.createContext)(null);
1778
- const AuthProvider2 = ({ children }) => {
1778
+ const AuthProvider = ({ children }) => {
1779
1779
  const storageType = options?.storage || "cookie";
1780
1780
  (0, import_react.useEffect)(() => {
1781
1781
  configureTokenManager({ storage: storageType });
@@ -1839,7 +1839,7 @@ function createAuthContext(options) {
1839
1839
  if (!ctx) throw new Error("useAuth must be used inside AuthProvider");
1840
1840
  return ctx;
1841
1841
  };
1842
- return { AuthProvider: AuthProvider2, useAuth: useAuth2 };
1842
+ return { AuthProvider, useAuth: useAuth2 };
1843
1843
  }
1844
1844
 
1845
1845
  // src/AuthGuard.tsx
@@ -1901,10 +1901,11 @@ var import_react3 = __toESM(require_react());
1901
1901
  import { useRouter as useRouter2 } from "next/navigation";
1902
1902
 
1903
1903
  // src/myAuth.ts
1904
- var { AuthProvider, useAuth } = createAppAuth();
1904
+ var auth = createAppAuth();
1905
1905
 
1906
1906
  // src/RoleGuard.tsx
1907
1907
  var import_jsx_runtime3 = __toESM(require_jsx_runtime());
1908
+ var { useAuth } = auth;
1908
1909
  var RoleGuard = ({
1909
1910
  children,
1910
1911
  allowedRoles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextauthz",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/RoleGuard.tsx CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { useEffect, useState } from 'react'
4
4
  import { useRouter } from 'next/navigation'
5
- import { useAuth } from './myAuth'
5
+ import { auth } from './myAuth'
6
6
 
7
7
  type RoleGuardProps = {
8
8
  children: React.ReactNode
@@ -10,6 +10,8 @@ type RoleGuardProps = {
10
10
  redirectTo?: string
11
11
  }
12
12
 
13
+ const { useAuth } = auth
14
+
13
15
  const RoleGuard = ({
14
16
  children,
15
17
  allowedRoles,
package/src/myAuth.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { createAppAuth } from "."
1
+ // myAuth.ts
2
+ 'use client'
2
3
 
4
+ import { createAppAuth } from '.'
3
5
 
4
6
  export type User = any
5
7
 
6
- // Create typed AuthProvider and useAuth hook
7
- export const { AuthProvider, useAuth } = createAppAuth()
8
+ // Export the factory
9
+ export const auth = createAppAuth() // { AuthProvider, useAuth }