@nocios/crudify-ui 1.0.90 → 1.0.91

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
@@ -2976,19 +2976,27 @@ var CrudifyDataProvider = ({
2976
2976
  const setToken = (0, import_react12.useCallback)((newToken) => {
2977
2977
  console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Setting new token:", newToken ? "provided" : "null");
2978
2978
  tokenManager.setToken(newToken);
2979
- console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Updating state directly");
2980
- const currentToken = tokenManager.getToken();
2981
- const parsedUser = tokenManager.parseToken();
2982
- const expiration = tokenManager.getTokenExpiration();
2983
- const authenticated = tokenManager.isAuthenticated();
2984
- setTokenState(currentToken);
2985
- setUser(parsedUser);
2986
- setTokenExpiration(expiration);
2987
- setIsAuthenticated(authenticated);
2988
- console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: State updated directly", {
2989
- hasToken: !!currentToken,
2990
- isAuthenticated: authenticated
2991
- });
2979
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Updating state using newToken directly");
2980
+ if (newToken) {
2981
+ const parsedUser = tokenManager.parseToken(newToken);
2982
+ const expiration = tokenManager.getTokenExpiration();
2983
+ const authenticated = tokenManager.isTokenValid(newToken);
2984
+ setTokenState(newToken);
2985
+ setUser(parsedUser);
2986
+ setTokenExpiration(expiration);
2987
+ setIsAuthenticated(authenticated);
2988
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Token set, state updated", {
2989
+ hasToken: true,
2990
+ isAuthenticated: authenticated,
2991
+ userEmail: parsedUser?.email || null
2992
+ });
2993
+ } else {
2994
+ setTokenState(null);
2995
+ setUser(null);
2996
+ setTokenExpiration(null);
2997
+ setIsAuthenticated(false);
2998
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Token cleared, state reset");
2999
+ }
2992
3000
  }, []);
2993
3001
  const logout = (0, import_react12.useCallback)(() => {
2994
3002
  console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Logging out user");
package/dist/index.mjs CHANGED
@@ -2941,19 +2941,27 @@ var CrudifyDataProvider = ({
2941
2941
  const setToken = useCallback2((newToken) => {
2942
2942
  console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Setting new token:", newToken ? "provided" : "null");
2943
2943
  tokenManager.setToken(newToken);
2944
- console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Updating state directly");
2945
- const currentToken = tokenManager.getToken();
2946
- const parsedUser = tokenManager.parseToken();
2947
- const expiration = tokenManager.getTokenExpiration();
2948
- const authenticated = tokenManager.isAuthenticated();
2949
- setTokenState(currentToken);
2950
- setUser(parsedUser);
2951
- setTokenExpiration(expiration);
2952
- setIsAuthenticated(authenticated);
2953
- console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: State updated directly", {
2954
- hasToken: !!currentToken,
2955
- isAuthenticated: authenticated
2956
- });
2944
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Updating state using newToken directly");
2945
+ if (newToken) {
2946
+ const parsedUser = tokenManager.parseToken(newToken);
2947
+ const expiration = tokenManager.getTokenExpiration();
2948
+ const authenticated = tokenManager.isTokenValid(newToken);
2949
+ setTokenState(newToken);
2950
+ setUser(parsedUser);
2951
+ setTokenExpiration(expiration);
2952
+ setIsAuthenticated(authenticated);
2953
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Token set, state updated", {
2954
+ hasToken: true,
2955
+ isAuthenticated: authenticated,
2956
+ userEmail: parsedUser?.email || null
2957
+ });
2958
+ } else {
2959
+ setTokenState(null);
2960
+ setUser(null);
2961
+ setTokenExpiration(null);
2962
+ setIsAuthenticated(false);
2963
+ console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Token cleared, state reset");
2964
+ }
2957
2965
  }, []);
2958
2966
  const logout = useCallback2(() => {
2959
2967
  console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Logging out user");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocios/crudify-ui",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "description": "Biblioteca de componentes UI para Crudify",
5
5
  "author": "Nocios",
6
6
  "license": "MIT",