export async function forgotPassword()

in src/Frontend/src/services/auth.ts [126:142]


export async function forgotPassword(email : string) : Promise<Boolean> {
    return new Promise<Boolean>(async (resolve, reject) => {
        try {
            api.post(ENDPOINT_AUTH_FORGOT_PASSWORD, { email }).then(response => {
                AlertInstance.alert(ALERT_SUCCESS, 'toast.success.auth.forgot_password_email_sent');
                resolve(true);
            }).catch((error: any) => {
                AlertInstance.alert(ALERT_ERROR, 'toast.errors.auth.error_api');
                if (process.env.NODE_ENV === 'development') console.error('API ERROR FORGOT PASSWORD: ' + error);
                reject(false);
            });                
        } catch (e) {
            if (process.env.NODE_ENV === 'development') console.error('PROMISE ERROR: ' + e);
            reject(false);
        }
    });
}