( email: string, password: string, rememberMe: boolean, )
| 113 | } |
| 114 | |
| 115 | export async function signInWithEmailAndPassword( |
| 116 | email: string, |
| 117 | password: string, |
| 118 | rememberMe: boolean, |
| 119 | ): Promise<UserCredential> { |
| 120 | if (Auth === undefined) throw new Error("Authentication uninitialized"); |
| 121 | await setPersistence(rememberMe, true); |
| 122 | |
| 123 | const { data: result, error } = await tryCatch( |
| 124 | firebaseSignInWithEmailAndPassword(Auth, email, password), |
| 125 | ); |
| 126 | if (error !== null) { |
| 127 | console.error(error); |
| 128 | throw translateFirebaseError( |
| 129 | error, |
| 130 | "Failed to sign in with email and password", |
| 131 | ); |
| 132 | } |
| 133 | |
| 134 | return result; |
| 135 | } |
| 136 | |
| 137 | export function setUserState( |
| 138 | options: { |
no test coverage detected