authera 1.2.8-test-15 → 1.2.8-test-17

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.
@@ -21,4 +21,5 @@ export declare function useAuth<T extends string>(): {
21
21
  };
22
22
  setAccessToken: (token: string) => void;
23
23
  setRefreshToken: (token: string) => void;
24
+ logout: () => void;
24
25
  };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { AuthContext, } from "../helper/context";
2
3
  import React from "react";
3
4
  export function useAuth() {
@@ -49,12 +50,12 @@ export function useAuth() {
49
50
  const setRefreshToken = (token) => {
50
51
  ctx.set("refresh_token", token);
51
52
  };
52
- // const logout = () => {
53
- // setUserData(null as any);
54
- // setPermits([]);
55
- // ctx.set("refresh_token", null);
56
- // ctx.set("access_token", null);
57
- // };
53
+ const logout = () => {
54
+ setUserData(null);
55
+ setPermits([]);
56
+ ctx.set("refresh_token", null);
57
+ ctx.set("access_token", null);
58
+ };
58
59
  return {
59
60
  permits: prm,
60
61
  isPermitted,
@@ -67,7 +68,7 @@ export function useAuth() {
67
68
  user,
68
69
  setAccessToken,
69
70
  setRefreshToken,
70
- // logout,
71
+ logout,
71
72
  ...authera_props,
72
73
  };
73
74
  }
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export default function AuthHook<T extends string>(props: AuthHookSettings<T>):
24
24
  };
25
25
  setAccessToken: (token: string) => void;
26
26
  setRefreshToken: (token: string) => void;
27
+ logout: () => void;
27
28
  };
28
29
  LoginScenario: () => import("react/jsx-runtime").JSX.Element;
29
30
  };
package/dist/web/login.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import axios from "axios";
3
4
  import { convertFromSchema } from "minimal-form";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authera",
3
- "version": "1.2.8-test-15",
3
+ "version": "1.2.8-test-17",
4
4
  "description": "this project is a simple auth hook for react",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",