mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-25 11:27:09 -05:00
* 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
24 lines
748 B
TypeScript
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)
|
|
})
|
|
}
|