wip: working, needs some unit tests for auth functions

This commit is contained in:
Loewy
2024-02-06 11:09:22 -08:00
parent d93d73dc3a
commit eb2534ff94
5 changed files with 31 additions and 22 deletions

View File

@@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import auth, { FirebaseAuthTypes } from '@react-native-firebase/auth';
import { Alert } from 'react-native';
export const signInWithPhoneNumber = async (phoneNumber: string): Promise<FirebaseAuthTypes.ConfirmationResult | undefined> => {
export const handleSignInWithPhoneNumber = async (phoneNumber: string): Promise<FirebaseAuthTypes.ConfirmationResult | undefined> => {
if (!phoneNumber) {
Alert.alert("Please enter a valid phone number with a country code");
return;
@@ -39,7 +39,7 @@ export const getCurrentUserToken = async (): Promise<string | null> => {
return null;
};
export const signOut = async (): Promise<void> => {
export const handleSignOut = async (): Promise<void> => {
await AsyncStorage.removeItem('token');
auth().signOut()
await auth().signOut()
}

View File

@@ -1,15 +1,15 @@
import {
signInWithPhoneNumber,
handleSignInWithPhoneNumber,
confirmCode,
onAuthStateChanged,
getCurrentUserToken,
signOut
handleSignOut
} from './firebase-auth'
export {
signInWithPhoneNumber,
handleSignInWithPhoneNumber,
confirmCode,
onAuthStateChanged,
getCurrentUserToken,
signOut
handleSignOut
}