Files
Compass/web/lib/firebase/password.ts
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

24 lines
748 B
TypeScript

import {sendPasswordResetEmail} from 'firebase/auth'
import toast from 'react-hot-toast'
import {auth} from 'web/lib/firebase/users'
export const sendPasswordReset = async (email: string | undefined) => {
if (!email) {
toast.error('No email found on your account.')
return
}
toast
.promise(sendPasswordResetEmail(auth, email), {
loading: 'Sending password reset email...',
success: 'Password reset email sent — check your inbox and spam.',
error: 'Failed to send password reset email.',
})
.catch((e) => {
if (e.code === 'auth/user-not-found') {
toast.error('No account found with that email.')
return
}
console.log('Failed to send password reset email', e)
})
}