@nocios/crudify-ui 3.0.16 → 3.0.18
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 +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -918,11 +918,12 @@ function useSession(options = {}) {
|
|
|
918
918
|
} : null
|
|
919
919
|
}));
|
|
920
920
|
} catch (error) {
|
|
921
|
+
const errorMessage = error instanceof Error ? error.message : "Initialization failed";
|
|
921
922
|
setState((prev) => ({
|
|
922
923
|
...prev,
|
|
923
924
|
isLoading: false,
|
|
924
925
|
isInitialized: true,
|
|
925
|
-
error:
|
|
926
|
+
error: errorMessage
|
|
926
927
|
}));
|
|
927
928
|
}
|
|
928
929
|
}, [options.autoRestore, options.enableLogging, options.onSessionExpired, options.onSessionRestored]);
|
|
@@ -944,18 +945,21 @@ function useSession(options = {}) {
|
|
|
944
945
|
isAuthenticated: false,
|
|
945
946
|
tokens: null,
|
|
946
947
|
isLoading: false,
|
|
947
|
-
error:
|
|
948
|
+
error: null
|
|
949
|
+
// No establecer error global para errores de login
|
|
948
950
|
}));
|
|
949
951
|
}
|
|
950
952
|
return result;
|
|
951
953
|
} catch (error) {
|
|
952
954
|
const errorMsg = error instanceof Error ? error.message : "Login failed";
|
|
955
|
+
const isCredentialError = errorMsg.includes("INVALID_CREDENTIALS") || errorMsg.includes("Invalid email") || errorMsg.includes("Invalid password") || errorMsg.includes("credentials");
|
|
953
956
|
setState((prev) => ({
|
|
954
957
|
...prev,
|
|
955
958
|
isAuthenticated: false,
|
|
956
959
|
tokens: null,
|
|
957
960
|
isLoading: false,
|
|
958
|
-
error: errorMsg
|
|
961
|
+
error: isCredentialError ? null : errorMsg
|
|
962
|
+
// Solo errores del sistema van al estado global
|
|
959
963
|
}));
|
|
960
964
|
return {
|
|
961
965
|
success: false,
|
package/dist/index.mjs
CHANGED
|
@@ -852,11 +852,12 @@ function useSession(options = {}) {
|
|
|
852
852
|
} : null
|
|
853
853
|
}));
|
|
854
854
|
} catch (error) {
|
|
855
|
+
const errorMessage = error instanceof Error ? error.message : "Initialization failed";
|
|
855
856
|
setState((prev) => ({
|
|
856
857
|
...prev,
|
|
857
858
|
isLoading: false,
|
|
858
859
|
isInitialized: true,
|
|
859
|
-
error:
|
|
860
|
+
error: errorMessage
|
|
860
861
|
}));
|
|
861
862
|
}
|
|
862
863
|
}, [options.autoRestore, options.enableLogging, options.onSessionExpired, options.onSessionRestored]);
|
|
@@ -878,18 +879,21 @@ function useSession(options = {}) {
|
|
|
878
879
|
isAuthenticated: false,
|
|
879
880
|
tokens: null,
|
|
880
881
|
isLoading: false,
|
|
881
|
-
error:
|
|
882
|
+
error: null
|
|
883
|
+
// No establecer error global para errores de login
|
|
882
884
|
}));
|
|
883
885
|
}
|
|
884
886
|
return result;
|
|
885
887
|
} catch (error) {
|
|
886
888
|
const errorMsg = error instanceof Error ? error.message : "Login failed";
|
|
889
|
+
const isCredentialError = errorMsg.includes("INVALID_CREDENTIALS") || errorMsg.includes("Invalid email") || errorMsg.includes("Invalid password") || errorMsg.includes("credentials");
|
|
887
890
|
setState((prev) => ({
|
|
888
891
|
...prev,
|
|
889
892
|
isAuthenticated: false,
|
|
890
893
|
tokens: null,
|
|
891
894
|
isLoading: false,
|
|
892
|
-
error: errorMsg
|
|
895
|
+
error: isCredentialError ? null : errorMsg
|
|
896
|
+
// Solo errores del sistema van al estado global
|
|
893
897
|
}));
|
|
894
898
|
return {
|
|
895
899
|
success: false,
|