@nocios/crudify-ui 1.0.89 → 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 +31 -6
- package/dist/index.mjs +31 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2974,15 +2974,40 @@ var CrudifyDataProvider = ({
|
|
|
2974
2974
|
}
|
|
2975
2975
|
}, []);
|
|
2976
2976
|
const setToken = (0, import_react12.useCallback)((newToken) => {
|
|
2977
|
-
console.log("\u{1F510} CrudifyDataProvider - Setting new token:", newToken ? "provided" : "null");
|
|
2977
|
+
console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Setting new token:", newToken ? "provided" : "null");
|
|
2978
2978
|
tokenManager.setToken(newToken);
|
|
2979
|
-
|
|
2980
|
-
|
|
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
|
+
}
|
|
3000
|
+
}, []);
|
|
2981
3001
|
const logout = (0, import_react12.useCallback)(() => {
|
|
2982
|
-
console.log("\u{1F510} CrudifyDataProvider - Logging out user");
|
|
3002
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Logging out user");
|
|
2983
3003
|
tokenManager.clearToken();
|
|
2984
|
-
|
|
2985
|
-
|
|
3004
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Updating state directly");
|
|
3005
|
+
setTokenState(null);
|
|
3006
|
+
setUser(null);
|
|
3007
|
+
setTokenExpiration(null);
|
|
3008
|
+
setIsAuthenticated(false);
|
|
3009
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: User logged out, state cleared");
|
|
3010
|
+
}, []);
|
|
2986
3011
|
const refreshConfig = (0, import_react12.useCallback)(() => {
|
|
2987
3012
|
console.log("\u{1F30D} CrudifyDataProvider - Refreshing configuration");
|
|
2988
3013
|
configurationManager.clearConfig();
|
package/dist/index.mjs
CHANGED
|
@@ -2939,15 +2939,40 @@ var CrudifyDataProvider = ({
|
|
|
2939
2939
|
}
|
|
2940
2940
|
}, []);
|
|
2941
2941
|
const setToken = useCallback2((newToken) => {
|
|
2942
|
-
console.log("\u{1F510} CrudifyDataProvider - Setting new token:", newToken ? "provided" : "null");
|
|
2942
|
+
console.log("\u{1F510} CrudifyDataProvider - SET_TOKEN_CALLBACK: Setting new token:", newToken ? "provided" : "null");
|
|
2943
2943
|
tokenManager.setToken(newToken);
|
|
2944
|
-
|
|
2945
|
-
|
|
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
|
+
}
|
|
2965
|
+
}, []);
|
|
2946
2966
|
const logout = useCallback2(() => {
|
|
2947
|
-
console.log("\u{1F510} CrudifyDataProvider - Logging out user");
|
|
2967
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Logging out user");
|
|
2948
2968
|
tokenManager.clearToken();
|
|
2949
|
-
|
|
2950
|
-
|
|
2969
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: Updating state directly");
|
|
2970
|
+
setTokenState(null);
|
|
2971
|
+
setUser(null);
|
|
2972
|
+
setTokenExpiration(null);
|
|
2973
|
+
setIsAuthenticated(false);
|
|
2974
|
+
console.log("\u{1F510} CrudifyDataProvider - LOGOUT_CALLBACK: User logged out, state cleared");
|
|
2975
|
+
}, []);
|
|
2951
2976
|
const refreshConfig = useCallback2(() => {
|
|
2952
2977
|
console.log("\u{1F30D} CrudifyDataProvider - Refreshing configuration");
|
|
2953
2978
|
configurationManager.clearConfig();
|