authera 1.2.4 → 1.2.5

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.
@@ -15,4 +15,8 @@ export declare function useAuth<T extends string>(): {
15
15
  removePermits: (permits: T[]) => void;
16
16
  setUserData: (userData: userBaseData<T>) => void;
17
17
  isPermittedAll: (perms: T[]) => boolean;
18
+ user: {
19
+ id: string;
20
+ username: string;
21
+ };
18
22
  };
@@ -6,7 +6,7 @@ export function useAuth() {
6
6
  if (!ctx)
7
7
  throw new Error("useAuth must be used within an AuthContext");
8
8
  // -------------------------------------------------- data
9
- const { permits: permitsData } = ctx.userData;
9
+ const { permits: permitsData, ...user } = ctx.userData;
10
10
  const prm = (permitsData || []);
11
11
  // -------------------------------------------------- funtions
12
12
  const isPermitted = (perm) => {
@@ -50,6 +50,7 @@ export function useAuth() {
50
50
  removePermits,
51
51
  setUserData,
52
52
  isPermittedAll,
53
+ user,
53
54
  ...ctx.authera_props,
54
55
  };
55
56
  }
package/dist/index.d.ts CHANGED
@@ -26,6 +26,10 @@ export default function AuthHook<T extends string>(props: AuthHookSettings<T>):
26
26
  removePermits: (permits: T[]) => void;
27
27
  setUserData: (userData: import("./helper/context").userBaseData<T>) => void;
28
28
  isPermittedAll: (perms: T[]) => boolean;
29
+ user: {
30
+ id: string;
31
+ username: string;
32
+ };
29
33
  };
30
34
  LoginScenario: () => import("react/jsx-runtime").JSX.Element;
31
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authera",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "this project is a simple auth hook for react",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",