@umituz/react-native-auth 3.1.10 → 3.1.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.11",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -40,11 +40,11 @@ export function useAuthRequired(): UseAuthRequiredResult {
|
|
|
40
40
|
const isAllowed = useAuthStore(selectIsAuthenticated);
|
|
41
41
|
const isLoading = useAuthStore((state) => state.loading);
|
|
42
42
|
const userId = useAuthStore((state) => state.firebaseUser?.uid ?? null);
|
|
43
|
-
const
|
|
43
|
+
const showAuthModal = useAuthModalStore((state) => state.showAuthModal);
|
|
44
44
|
|
|
45
45
|
const requireAuth = useCallback(() => {
|
|
46
|
-
|
|
47
|
-
}, [
|
|
46
|
+
showAuthModal(undefined, "login");
|
|
47
|
+
}, [showAuthModal]);
|
|
48
48
|
|
|
49
49
|
const checkAndRequireAuth = useCallback((): boolean => {
|
|
50
50
|
if (isLoading) {
|
|
@@ -52,12 +52,12 @@ export function useAuthRequired(): UseAuthRequiredResult {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (!isAllowed) {
|
|
55
|
-
|
|
55
|
+
showAuthModal(undefined, "login");
|
|
56
56
|
return false;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return true;
|
|
60
|
-
}, [isAllowed, isLoading,
|
|
60
|
+
}, [isAllowed, isLoading, showAuthModal]);
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
63
|
isAllowed,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import { useEffect, type ReactNode } from "react";
|
|
14
14
|
import { initializeAuthListener } from "../stores/authStore";
|
|
15
15
|
|
|
16
16
|
interface AuthProviderProps {
|
|
@@ -22,7 +22,7 @@ interface AuthProviderProps {
|
|
|
22
22
|
* Initializes Firebase auth listener on mount
|
|
23
23
|
* Must wrap the app root
|
|
24
24
|
*/
|
|
25
|
-
export function AuthProvider({ children }: AuthProviderProps):
|
|
25
|
+
export function AuthProvider({ children }: AuthProviderProps): ReactNode {
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
const unsubscribe = initializeAuthListener();
|
|
28
28
|
return unsubscribe;
|