@ssplib/react-components 0.0.256 → 0.0.257

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.
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  export declare const cookieName = "nextauth.token";
3
- export declare function KeycloakAuthProvider({ url, realm, clientId, children, type, resource_name, }: {
3
+ export declare function KeycloakAuthProvider({ url, realm, clientId, children, type, resource_name, redirectUri, }: {
4
4
  url: string;
5
5
  realm: string;
6
6
  clientId: string;
7
7
  children: JSX.Element | JSX.Element[];
8
8
  type?: 'govbr' | 'ad';
9
9
  resource_name?: string;
10
+ redirectUri?: string;
10
11
  }): JSX.Element;
@@ -33,11 +33,10 @@ const auth_1 = require("../../context/auth");
33
33
  const keycloak_js_1 = __importDefault(require("keycloak-js"));
34
34
  exports.cookieName = 'nextauth.token';
35
35
  const userImgName = 'user-data.img';
36
- function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', resource_name = 'eventos-front', }) {
36
+ function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', resource_name = 'eventos-front', redirectUri = '', }) {
37
37
  const [user, setUser] = (0, react_1.useState)();
38
38
  const [userLoaded, setUserLoaded] = (0, react_1.useState)(false);
39
39
  const [kc, setKc] = (0, react_1.useState)(null);
40
- const [token, setToken] = (0, react_1.useState)(undefined);
41
40
  const router = (0, router_1.useRouter)();
42
41
  const isAuth = !!user;
43
42
  (0, react_1.useEffect)(() => {
@@ -87,7 +86,7 @@ function KeycloakAuthProvider({ url, realm, clientId, children, type = 'ad', res
87
86
  logado: kc === null || kc === void 0 ? void 0 : kc.authenticated,
88
87
  client_id: kc === null || kc === void 0 ? void 0 : kc.clientId,
89
88
  });
90
- kc === null || kc === void 0 ? void 0 : kc.login();
89
+ kc === null || kc === void 0 ? void 0 : kc.login({ redirectUri });
91
90
  }
92
91
  function logout() {
93
92
  setUserLoaded(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.256",
3
+ "version": "0.0.257",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",